Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
using System.Net.Mail;

public static void Send(NotificationMessage message)
        {
            MailMessage objMessage = new MailMessage()
            {
                From = new MailAddress(ConfigurationManager.AppSettings["Email.Sender"]),
                Subject = message.Subject,
                BodyEncoding = Encoding.UTF8,
                IsBodyHtml = true,
                Body = message.MessageBody,
            };

            foreach (var recipient in message.RecipientName)
                objMessage.To.Add(recipient);

            SmtpClient SmtpMail = new SmtpClient(ConfigurationManager.AppSettings["Email.ServerName"]);
            SmtpMail.Send(objMessage);
        }


If body is:
"No entity found for this identifier: 201511300"
mail is sent but not delivered. No exception nothing.

if body is just:
"No entity found for this identifier 201511300" -- without colon the mail is delivered fine.

if you have any thought why this might happen please share them ;)
Posted
Comments
ZurdoDev 30-Nov-15 9:49am    
Try sending to different email clients.
George Jonsson 30-Nov-15 10:07am    
As you have set IsBodyHtml = true, you can try to escape the colon like this
& #58; (No space between & and #)
and also change
IsBodyHtml = false
Just to see what happens.
Richard Deeming 30-Nov-15 10:24am    
Check the recipient's mail server's spam filters. Short of a major bug, that's the only thing that's going to prevent mail being delivered based on the content of the message.
xszaboj 30-Nov-15 10:31am    
I've added solution with your comment. Could you please provide some references or explanation why this happen? Add it as solution please. Thank you very much ;)

1 solution

Based on Richard Deeming comment:

Check the recipient's mail server's spam filters. Short of a major bug, that's the only thing that's going to prevent mail being delivered based on the content of the message.

I've done that and it is the case. All mails end up in spam folder.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900