| 1 |
<?php
|
| 2 |
// $Id: smtp.inc,v 1.5 2003/11/17 15:36:57 kjartan Exp $
|
| 3 |
include_once 'includes/class.smtp.inc';
|
| 4 |
|
| 5 |
function user_mail_wrapper($mail, $subject, $message, $header) {
|
| 6 |
// The smtp server host/ip
|
| 7 |
$params['host'] = ini_get('SMTP');
|
| 8 |
// The smtp server port
|
| 9 |
$params['port'] = 25;
|
| 10 |
// What to use when sending the helo command. Typically, your domain/hostname
|
| 11 |
$params['helo'] = $_SERVER['HTTP_HOST'];
|
| 12 |
// Whether to use basic authentication or not
|
| 13 |
$params['auth'] = FALSE;
|
| 14 |
// Username for authentication
|
| 15 |
//$params['user'] = 'testuser';
|
| 16 |
// Password for authentication
|
| 17 |
//$params['pass'] = 'testuser';
|
| 18 |
|
| 19 |
// The recipients (can be multiple)
|
| 20 |
$send_params['recipients'] = $mail;
|
| 21 |
// The headers of the mail
|
| 22 |
$send_params['headers'] = explode("\n", $header ."\nSubject: $subject\nTo: $mail");
|
| 23 |
// The body of the email
|
| 24 |
$send_params['body'] = str_replace("\n", "\r\n", $message);
|
| 25 |
|
| 26 |
$smtp = smtp::connect($params);
|
| 27 |
if (count($smtp->errors)) {
|
| 28 |
watchdog('error', 'mail connect error: '. implode('<br />', $smtp->errors));
|
| 29 |
return false;
|
| 30 |
}
|
| 31 |
$smtp->send($send_params);
|
| 32 |
if (count($smtp->errors)) {
|
| 33 |
watchdog('error', 'mail send error: '. implode('<br />', $smtp->errors));
|
| 34 |
return false;
|
| 35 |
}
|
| 36 |
|
| 37 |
return true;
|
| 38 |
}
|
| 39 |
?>
|