diff --git a/html/inc/email.inc b/html/inc/email.inc index 6189393b18..becc511200 100644 --- a/html/inc/email.inc +++ b/html/inc/email.inc @@ -25,24 +25,12 @@ require_once("../project/project.inc"); $config = get_config(); $master_url = parse_config($config, ""); -// Determine if phpmailer is installed and to be used (defined in project.inc) -if (isset($USE_PHPMAILER)) { - if ($USE_PHPMAILER) { - require_once("../inc/phpmailer/class.phpmailer.php"); - } -} else { - $USE_PHPMAILER = false; -} - // send an email, using PHPMailer or not. // function send_email($user, $subject, $body, $body_html=null) { - global $USE_PHPMAILER; - global $PHPMAILER_HOST; - global $PHPMAILER_MAILER; - - if ($USE_PHPMAILER) { - $mail = new PHPMailer(); + if (function_exists("make_php_mailer")) { + require_once("../inc/phpmailer/class.phpmailer.php"); + $mail = make_php_mailer(); $mail->AddAddress($user->email_addr, $user->name); $mail->Subject = $subject; if ($body_html) { @@ -51,10 +39,6 @@ function send_email($user, $subject, $body, $body_html=null) { } else { $mail->Body = $body; } - $mail->From = EMAIL_FROM; - $mail->FromName = EMAIL_FROM_NAME; - $mail->Host = $PHPMAILER_HOST; - $mail->Mailer = $PHPMAILER_MAILER; if (!$mail->Send()) { echo $mail->ErrorInfo; return false; diff --git a/html/project.sample/project.inc b/html/project.sample/project.inc index a578662d5a..badf82f3d2 100644 --- a/html/project.sample/project.inc +++ b/html/project.sample/project.inc @@ -29,6 +29,33 @@ define("UOTD_ADMIN_EMAIL", "admin@$master_url"); // offensive forum posts. define("POST_REPORT_EMAILS", "moderator1@$master_url|moderator2@$master_url"); +// If you use PHPMailer, uncomment the following +// and complete the function definition based on your SMTP server +// (not all fields may be needed) +// +if (0) { +function make_php_mailer() { + $mail = new PHPMailer(); + $mail->IsSMTP(); + //$mail->Mailer = 'smtp'; + $mail->SMTPAuth = true; + $mail->SMTPSecure = "tls"; + $mail->Host = "smtp.gmail.com"; + $mail->Port = 587; + $mail->Username = "john.doe@gmail.com"; + $mail->Password = "xxx"; + // Google's application-specific password, + // if you are using the 2-Step Verification: 16 characters, no spaces. + // OR: Put here the regular Gmail password if you are not using the + // 2-Step Verification with your Gmail account. + // See https://support.google.com/accounts/answer/185833?hl=en"; + $mail->SetFrom('admin@boincproject.com', 'John Doe'); + $mail->AddReplyTo("admin@boincproject.com", "John Doe"); + $mail->From = "admin@boincproject.com"; + return $mail; +} +} + function project_banner($title, $prefix) { // Put your project title and logo here // If you include any links, prepend URL with $prefix