diff options
| author | roundcube <roundcube@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2005-09-30 22:04:50 +0000 |
|---|---|---|
| committer | roundcube <roundcube@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2005-09-30 22:04:50 +0000 |
| commit | 35cc90fc9f49a2dacd79d7c32e846f91e28af210 (patch) | |
| tree | 3941d505a4c27b927535cf5f87106ed6c11e975b /roundcubemail/program/steps | |
| parent | 3e0b457ce893a6a309b573a270336fb3ef4edac7 (diff) | |
Improved SMTP script for sending mails. Now using the PEAR::Net_SMTP class
git-svn-id: https://svn.roundcube.net/trunk@11 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
| -rw-r--r-- | roundcubemail/program/steps/mail/sendmail.inc | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/roundcubemail/program/steps/mail/sendmail.inc b/roundcubemail/program/steps/mail/sendmail.inc index e33593139..2172accc8 100644 --- a/roundcubemail/program/steps/mail/sendmail.inc +++ b/roundcubemail/program/steps/mail/sendmail.inc @@ -21,7 +21,8 @@ */ -require_once('lib/smtp.inc'); +//require_once('lib/smtp.inc'); +require_once('include/rcube_smtp.inc'); require_once('Mail/mime.php'); @@ -155,30 +156,28 @@ $msg_subject = $headers['Subject']; // send thru SMTP server using cusotm SMTP library if ($CONFIG['smtp_server']) { - // connect to SMTP server - $smtp_conn = smtp_connect($CONFIG['smtp_server'], '25', $CONFIG['smtp_user'], $CONFIG['smtp_pass']); - - if ($smtp_conn) - { - // generate list of recipients - $recipients = $mailto.', '.$headers['Cc'].', '.$headers['Bcc']; - $a_recipients = smtp_expand($recipients); + // generate list of recipients + $a_recipients = array($mailto); + + if (strlen($headers['Cc'])) + $a_recipients[] = $headers['Cc']; + if (strlen($headers['Bcc'])) + $a_recipients[] = $headers['Bcc']; + + // generate message headers + $header_str = $MAIL_MIME->txtHeaders($headers); + + // send message + $sent = smtp_mail($from, $a_recipients, $header_str, $msg_body); - // generate message headers - $header_str = $MAIL_MIME->txtHeaders($headers); - - // send message - $sent = smtp_mail($smtp_conn, $from, $a_recipients, $header_str."\r\n".$msg_body, FALSE); - } - // log error - if (!$smtp_conn || !$sent) + if (!$sent) { raise_error(array('code' => 800, 'type' => 'smtp', 'line' => __LINE__, 'file' => __FILE__, - 'message' => "Connection failed: $smtp_error"), TRUE, FALSE); + 'message' => "SMTP error: $SMTP_ERROR"), TRUE, FALSE); } } |
