function mail($toaddress, $subject, $message, $fromname = '', $replyto = '') { $toArray = explode(',', $toaddress); $fromaddress = $toArray[0]; $myMail = new wbmailer(); // set user defined from address if ($fromaddress != '') { if ($fromname != '') { $myMail->FromName = $fromname; } // FROM-NAME $myMail->From = $fromaddress; // FROM: } if ($replyto != '') { $myMail->AddReplyTo($replyto); // REPLY TO: } // define recepient and information to send out foreach ($toArray as $toAddr) { // TO: $myMail->AddAddress($toAddr); } $myMail->Subject = $subject; // SUBJECT $myMail->Body = $message; // CONTENT (HTML) $textbody = strip_tags($message); $textbody = str_replace("\t", "", $textbody); while (strpos($textbody, "\n\n\n") !== false) { $textbody = str_replace("\n\n\n", "\n\n", $textbody); } while (strpos($textbody, "\r\n\r\n\r\n") !== false) { $textbody = str_replace("\r\n\r\n\r\n", "\r\n\r\n", $textbody); } $myMail->AltBody = $textbody; // CONTENT (TEXT) foreach ($this->attachements as $filename => $file) { $myMail->AddAttachment($file, $filename); } // check if there are any send mail errors, otherwise say successful if (!$myMail->Send()) { return false; } else { return true; } }
public function mail($fromaddress, $toaddress, $subject, $message, $fromname = '') { /* INTEGRATED OPEN SOURCE PHPMAILER CLASS FOR SMTP SUPPORT AND MORE SOME SERVICE PROVIDERS DO NOT SUPPORT SENDING MAIL VIA PHP AS IT DOES NOT PROVIDE SMTP AUTHENTICATION NEW WBMAILER CLASS IS ABLE TO SEND OUT MESSAGES USING SMTP WHICH RESOLVE THESE ISSUE (C. Sommer) NOTE: To use SMTP for sending out mails, you have to specify the SMTP host of your domain via the Settings panel in the backend of Website Baker */ $fromaddress = preg_replace('/[\\r\\n]/', '', $fromaddress); $toaddress = preg_replace('/[\\r\\n]/', '', $toaddress); $subject = preg_replace('/[\\r\\n]/', '', $subject); $message = preg_replace('/\\r\\n?|\\n/', '<br \\>', $message); // create PHPMailer object and define default settings $myMail = new wbmailer(); // set user defined from address if ($fromaddress != '') { if ($fromname != '') { $myMail->FromName = $fromname; } // FROM-NAME $myMail->From = $fromaddress; // FROM: $myMail->AddReplyTo($fromaddress); // REPLY TO: } //$fromaddress != '' // define recepient and information to send out $myMail->AddAddress($toaddress); // TO: $myMail->Subject = $subject; // SUBJECT $myMail->Body = $message; // CONTENT (HTML) $myMail->AltBody = strip_tags($message); // CONTENT (TEXT) // check if there are any send mail errors, otherwise say successful if (!$myMail->Send()) { return false; } else { return true; } }
$H2 = explode("|", $row['adres']); $parseMailArray = array('lid' => sprintf("%s %s %s %s", isset($H1[0]) ? $H1[0] : "", isset($H1[1]) ? $H1[1] : "", isset($H1[2]) ? $H1[2] : "", isset($H1[3]) ? $H1[3] : ""), 'adres' => sprintf("%s<br />%s<br />%s<br />%s<br />%s", isset($H2[0]) ? $H2[0] : "", isset($H2[1]) ? $H2[1] : "", isset($H2[2]) ? $H2[2] : "", isset($H2[3]) ? $H2[3] : "", isset($H2[4]) ? $H2[4] : ""), 'mail' => sprintf("E-mail: %s", $row['note'] > 1 ? $row['email'] : " onbekend"), 'date' => date("j M Y"), 'tel' => sprintf("%s", strlen($row['contact']) > 6 ? str_replace("|", " ", $row['contact']) : " Telefoon of mobiel nummer onbekend"), 'tebetalen' => $H0, 'betaalref' => sprintf("%s-00%s-%s ", isset($settingArr['prefix']) ? $settingArr['prefix'] : "Nota:", $row['id'], $H3)); $hulp = $contentArr[$regelsArr['wrtekst']]; $regelsArr['tekst'] = Gsm_prout($hulp, $parseMailArray); if ($row['id'] < 500) { $MassMail = new wbmailer(true); $MassMail->FromName = "Penningmeester Achtse Belangen"; // The From name of the message. $MassMail->From = $regelsArr['user_mail']; // The From email address for the message. $MassMail->AddReplyTo($regelsArr['user_mail'], $_SESSION['DISPLAY_NAME']); // Add a "Reply-to" address. $MassMail->Subject = $regelsArr['subject']; // The Subject of the message. if ($debug) { $MassMail->AddAddress($regelsArr['user_mail']); // Add a "To" address. $hulp = "rerouted from" . ($row['note'] > 1) ? "(>1)" . $row['email'] : "(=1)" . $regelsArr['post_mail']; $regelsArr['tekst'] = $hulp . "<br />" . $regelsArr['tekst']; } else { if ($row['note'] > 1) { $MassMail->AddAddress($row['email']); // Add a "To" address. $row['email'] } else { $MassMail->AddAddress($regelsArr['post_mail']); } } $MassMail->Body = $regelsArr['tekst']; // Clients that can read HTML will view the normal Body. $MassMail->AltBody = strip_tags($regelsArr['tekst']); // This body can be read by mail clients that do not have HTML email