主题: roundcube0.2stable增加成功发送邮件后自动添加收件人到通讯录
公司有人建议,发送邮件后把收件人地址自动加到自己的通讯录中。
看代码后修改如下:
roundcube安装目录/programe/steps/mail/func.inc
修改上面文件,到1280行,添加代码:
//for auto add email adreess after send mail successfully.
$CONTACTS = $RCMAIL->get_address_book(null, true);
$tmp = explode(",", $mailto);
foreach($tmp as $value){
//Avoid the exist address to be added!
//Because, exist: Example <example@example.com>, as new one.
if(!strpos($value, '<')){
$name = ucfirst(preg_replace('/[\.\-]/', ' ', substr($value, 0, strpos($value, '@'))));
$contact = array(
'email' => $value,
'name' => $name
);
// check for existing contacts
$existing = $CONTACTS->search('email', $value, true, false);
if (!($existing->count))
$CONTACTS->insert($contact);
}
}
保存退出即可。
[ 本帖最后由 bigwawa 于 2009-6-5 15:20 编辑 ]