Update of /cvsroot/phpbt/phpbt/inc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22660/phpbt/inc
Modified Files:
functions.php
Log Message:
RFE #1068977 - Add SMTP Server, User and Password
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- functions.php 22 Aug 2005 20:40:08 -0000 1.59
+++ functions.php 22 Aug 2005 20:50:23 -0000 1.60
@@ -592,32 +592,38 @@
}
// mailer with use of quoted-printable encoding (if configured so)
-function qp_mail($to, $subject = 'No subject', $body, $headers = '') {
+function qp_mail($to, $subject = 'No subject', $body, $from = ADMIN_EMAIL) {
global $STRING;
- $subject="=?".CHARSET."?B?".base64_encode($subject)."?=";
+ require_once('./inc/htmlMimeMail/htmlMimeMail.php');
+ $mail = new htmlMimeMail();
+ $mail->setSubject($subject);
+ $mail->setFrom($from);
+ $recipient[] = $to;
- if ($headers != '') {
- $headers .= "\n";
- // There have to be no newline at the end of $headers
+ if (SEND_MIME_EMAIL) {
+ // If configured to send MIME encoded emails
+ if (false/*HTML_EMAIL*/) {
+ $mail->setHtmlEncoding("quoted-printable");
+ $mail->setHtml($body);
+ }
+ else {
+ $mail->setTextEncoding("quoted-printable");
+ $mail->setText($body);
+ }
}
-
- if (false/*HTML_EMAIL*/) {
- $headers .= "Content-Type: text/html; charset=\"".CHARSET."\"\r\nContent-Transfer-Encoding: ";
- } else {
- $headers .= "Content-Type: text/plain; charset=\"".CHARSET."\"\r\nContent-Transfer-Encoding: ";
+ else {
+ $mail->setTextEncoding("8bit");
+ $mail->setText($body);
}
- // If configured to send MIME encoded emails
- if (SEND_MIME_EMAIL) {
- $retval = mail ($to, $subject, qp_enc($body), $headers.
- "quoted-printable\nMIME-Version: 1.0");
- } else {
- $retval = mail ($to, $subject, $body, $headers.
- "8bit");
+ if (SMTP_EMAIL) {
+ $mail->setSMTPParams(SMTP_HOST, SMTP_PORT, SMTP_HELO, SMTP_AUTH, SMTP_AUTH_USER, SMTP_AUTH_PASS);
}
- // Returns true if mail is eccepted for delivery, otherwise return false
+ $retval = $mail->send($recipient, SMTP_EMAIL ? 'smtp' : 'mail');
+
+ // Returns true if mail is accepted for delivery, otherwise return false
return ($retval);
}
|