Hi all,
I have a new webform where my clients enter their info. Upon clicking a register button, an email should be sent to them for the verification.
Everything is working fine except when the client email address resides on gmail, hotmail... the sent email is considered as spam because of the applied spam filter on their pop3 server.
I did some researches on the issue and found the following:
My email header contains a date format without the day in letters at the begining, "from:" instead of "From", "date:" instead of "Date:"... all the labels (if i may call them labels) start with a small letter while they should start in a capital letter.
Doing some more researches, i found that this is the behavior of System.Net.Mail.
Well, I do not like this behavior
and I am asking your help to complete my research to fix this issue.
MailMessage objEmail =new MailMessage(); objEmail.To.Add(ClientEmail); objEmail.From =new MailAddress(Myemail); objEmail.Subject ="Verification Message"; objEmail.Body ="Date : " + strDate +"\n"; objEmail.Body +="First Name : " + txtFirstName.Text +"\n"; objEmail.Body +="Last Name : " + txtLastName.Text +"\n"; objEmail.Body +="Company : " + txtCompany.Text +"\n"; objEmail.Body +="Phone : " + txtPhoneNumber.Text +"\n"; objEmail.Body +="Email : " + txtEmail.Text +"\n"; objEmail.Body +="Time to Contact: " + ddlTTC.SelectedValue +"\n"; objEmail.Body +="Message : " +"\n\n"; objEmail.Body += txtMessage.Text; objEmail.Priority = MailPriority.High; objEmail.Headers.Set("Message-ID", strMID ); SmtpClient smtp =new SmtpClient("smtp.somemailserver.com"); smtp.Port = nPort; smtp.EnableSsl =false; smtp.Send(objEmail);
As you can see, I am using two objects in this code:
MailMessage
objEmailSmtpClient
smtp
I think the header is generated in the call smtp.send(objEmail). What do you think?
Do you think MailMessageEventHandler and MailMessageEventArgs will help?
I am still waiting for your responses.
0 comments:
Post a Comment