Unfortunately, there are multiple possible causes of this issue (see this or this, for example). They include from bad characters in From
or To
headers, duplicate From
or To
headers or missing Date
header. Office 365 is based on Microsoft Exchange which does all kind of processing on messages it transmit, so it's quite possible that some aspect of MIME messages produced by Rebex Secure Mail could trigger some behavior at the server that results in Gmail rejecting the message.
However, the fact that it's a combination of Rebex Secure Mail and Office 365 makes this particular case difficult to analyze. Could you please save one of the messages that trigger this issue to a file (using MailMessage
or MimeMessage
object's Save
method), open it using a text editor (such as Notepad) and post its headers (or mail them to support@rebex.net) for analysis? If we could reproduce the issue, we might be able to quickly solve it as well. Thanks!
Update: In the meantime, we tried sending a simple e-mail message through Office 365 to Gmail and this works without issues:
static void Main(string[] args)
{
string from = "Tester <tester@rebexcz.onmicrosoft.com>";
string to = "Rebex Test <rebex.test@gmail.com>, Rebex Support <support@rebex.net>";
string subject = "From Office 365 to GMail.";
string body = "Sample body\r\nFlow:\r\n\tOffice 365 -> GMail.";
string username = "tester@rebexcz.onmicrosoft.com";
string password = ...;
var mail = new MailMessage();
mail.From = from;
mail.To = to;
mail.Subject = subject;
mail.BodyText = body;
using (var smtp = new Smtp())
{
smtp.Connect("outlook.office365.com", SslMode.Explicit);
smtp.Login(username, password);
smtp.Send(mail);
smtp.Disconnect();
}
}