Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $from = "Info <donotreply@test.com>";
- $subject = "Calibration will be expiring!";
- $body = 'Hello';
- $to = "david@test.com, dono@test.com";
- $cc = "rena@test.com";
- $bcc = ""; //sometimes BCC can be empty
- $host = 'smtp.test.com';
- $port = '587';
- $username = 'donotreply@test.com';
- $password = 'dontreply?';
- $headers = array(
- 'Port' => $port,
- 'From' => $from,
- 'To' => $to,
- 'Subject' => $subject,
- 'Content-Type' => 'text/html; charset=UTF-8',
- 'Cc' => $cc
- );
- $recipients = $to.", ".$bcc.", ".$cc;
- $smtp = Mail::factory('smtp',
- array ('host' => $host,
- 'auth' => true,
- 'username' => $username,
- 'password' => $password));
- $mail = $smtp->send($recipients, $headers, $body);
- if (PEAR::isError($mail)) {
- echo("<p>" . $mail->getMessage() . "</p>");
- } else {
- echo("<p>Message successfully sent!</p>");
- }
- Failed to add recipient: @localhost [SMTP: Invalid response code received from server (code: 501, response: 5.1.3 Invalid address [HKXPR02MB0695.apcprd02.prod.outlook.com])]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement