how to cc on drupal_mail
I tried the following:
function tester_mail($key, &$message, $params) {
switch($key) {
case 'notice':
$message['subject'] = t('Notificati开发者_如何学Goon from site');
$message['body'][] = t("Dear username\n\nThere is new content available on the site.{$params['node']}");
$message['headers']['CC'] = "tester@gmail.com";
break;
}
}
The function works, I get the email in cc. However, I get an error in UI:
Deprecated function: Function split() is deprecated in SmtpMailSystem->mail() (line 243 of /opt/....../htdocs/sites/all/modules/smtp/smtp.mail.inc).
The split()
function was deprecated in PHP 5.3.0 and PHP is just warning you of that fact. You could try adjusting your error_reporting settings (perhaps in .htaccess or in php.ini if you have that access) so deprecated functions don't invoke a notice. There's some good info here that should get you started.
Documentation page for split()
: http://php.net/manual/en/function.split.php
Edit
Alternatively you could just edit the code on line 243 of smtp.mail.inc and change it to this:
$ccrecipients = explode(',', $value);
That will have exactly the same effect but doesn't use a deprecated function.
Bear in mind that the Drupal 7 of the SMTP module is currently in development stage (no stable releases) so these kind of bugs are to be expected. If you haven't already you might want to think about raising an issue on the module page: http://drupal.org/project/smtp
精彩评论