I have been using PHPMailer for quite a while with no problems until recently when our company migrated from an on premiss Exchange server to Office365. We use PHPMailer because it allows us to send attachments. we actually received a response from Office365 that states "Your message contains invalid characters (bare line feed characters) which the email servers at NameOfCompanyServer.com don't Support".
So my question is, how can I remove the "bare line feed characters" when using PHPMailer? Or is there another third party PHP supported mailer that I can use to send attachments?
here is a sample of my PHP script
<?php
require_once("phpMailer\class.phpmailer.php");
require_once("phpMailer\class.smtp.php");
$mail = new PHPMailer();
$body = file_get_contents('OFFICE365.txt');
$body = eregi_replace("[\]",'',$body);
$mail->IsMail();
$mail->SMTPDebug = 3;
$mail->Host = "companyOffice365-domainhere.mail.protection.outlook.com";
$mail->Port = 25;
$mail->Username = "";
$mail->Password = "";
$mail->SMTPSecure = 'tls';
$mail->SetFrom('someone@companyOffice365-domainhere.com', 'Mailer');
$mail->AddReplyTo("NoReply@companyOffice365-domainhere.com","");
$mail->Subject = "Email Test via IsMail, using OFFICE365";
$mail->MsgHTML($body);
//Recipients
$address = "emailaddress@somewhere.com";
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
hope someone can help here, thanks B