Hello,
I am sending mail from default smtp virtual server.But my mail is going on spam inwww.hotmail.com. My C# code is
privatestaticstring sendEmail(string frm,string to,string subj,string bdy,string cc)
{
try
{
System.Web.Mail.MailMessage msg =new System.Web.Mail.MailMessage();msg.From = frm;
msg.To = to;
msg.Body = bdy;
msg.Subject = subj;
msg.BodyFormat = System.Web.Mail.MailFormat.Html;
SmtpMail.SmtpServer="";
SmtpMail.Send(msg);return"Success";
}
catch(Exception ex){
return ex.Message;}
}
If there is somthing wrong or you have suggestion then reply asap.
Are you using a SMTP server on a dynamic IP? Do you have proper SPF records in DNS for it? Have you looked at AOL's help for email spam?
Jeff
I think this has to be configured on the Mail server side. It has nothing to do with your C# code.
Hey authenticate your SMTP mail using the following code.
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 25;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "yourname@.websitename.com";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "yourpassword";
mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpusessl"]= "true";
this will send user name and password to server and you will be logged on to the server.
for reference::http://www.codeproject.com/useritems/smtpmail.asp
We had a similar kind of problem where I work and what I believe it is related to is settings on the SMTP (Are you using Exchange?) Server and not your SMTP settings in Web.Config
But just for clarity here is our Web.Config entry for SMTP mail settings which is working for us where I work:
<!--mAIL--><system.net>
<mailSettingsdeliveryMethod="Network"><smtpfrom=Administrator@.OurCompany.org>
<networkhost="OUR-MAILSVR"port="25"password=""userName=""/></smtp>
</mailSettings></system.net>
* Now there is probably many ways to go about setting this up but I think the last post was right in saying you need to check your SPF entries because if you are relaying mail then it looks like a spammer who has thousands of computers relaying mail through thousands of SPF (IP) entries in Exchange. You probably need to have a direct entry from one email address or only one relay so it doesn't look suspicious to an email provider like hotmail.
Hope this helps,
Ian
* Be sure to mark as answer if it indeed is
it's probably not your code, it's your mail server.
your mailserver is not listed as a valid mailserver in the internet DNS system (SPF record or reverse pointer, something like that)
when the mail arrives at hotmail, it is marking it as spam since it's not receiving the message from a host with a valid DNS entry.
This one way mail servers marks mail as spam.
try using your ISP's mail server. Their mail server is probably registered in the DNS system as mail server.
Thanks for reply.
My site is hosted on public IP.And we are using our default smtp virtual server.How can I handle this.
Regards,
Pawan
default smtp virtual server
I am assuming you have the server "in house" and using some public IP from an ISP.
You need to change the smtp server to the ISP's smtp server.
Let's say you are using Comcast. You would change the smtp server from "localhost" to "smtp.comcast.net" instead of localhost.
You would need to configure the smtp port, and authentication - all depending on your ISP. ( Comcast uses port 587 and requires authentication)
If you use your ISP for your own personal mail, the settings are in your email program ( like Outlook Express)
the best reference for sending mail via asp.net ishttp://www.systemnetmail.com/
I've had this problem before and it turned out to be the wording in the body and subject of the email that was causing it to register as spam. In my case there was not subject and entering one correct this.
0 comments:
Post a Comment