c# - Email messages going to spam folder -
i have created community portal, in user creates his/her account. after successfull registration confirmation mail send on registered email address.
i using following code send mail -
private void sendmail(string recvr, string recvrname, string vercode, int newuserid) { try { string emailid = configurationmanager.appsettings["webmastermail"]; string mailpass = configurationmanager.appsettings["pass"]; string mailer = configurationmanager.appsettings["mailer"]; mailmessage msg = new mailmessage(); mailaddress addrfrom = new mailaddress(emailid, "panbeli.in.... bari community portal"); mailaddress addrto = new mailaddress(recvr, recvrname); msg.to.add(addrto); msg.from = addrfrom; msg.subject = "you have registered sucessfully on panbeli.in."; msg.priority = mailpriority.high; msg.body = registermessagebody(recvrname, vercode,newuserid); msg.isbodyhtml = true; smtpclient smtp = new smtpclient(mailer); smtp.credentials = new system.net.networkcredential(emailid, mailpass); smtp.send(msg); } catch (exception ex) { } }
while testing found confirmation mails going spam folder instead of inbox.
is there wrong code or there related security.
can suggest solution problem.
thanks sharing time.
it sounds email getting flagged spamassassin or like, need focus on changing email enough not flagged.
your content doesn't sound has reason rate high bayesian score, don't think thats problem. wouldn't hurt try removing possible trigger words though.
your message marked high priority. need this? adds 1 of scoring metrics in spam filter. spam marked high priority, message treated more scrutiny. on otherhand, filters marking message high priority mean less scrutiny.
isbodyhtml
marked true, you're providingtext/html
. minimally need include alternate viewtext/plain
.message.isbodyhtml = true; string html = registermessagebodyhtml(recvrname, vercode,newuserid); string plain = registermessagebodyplaintext(recvrname, vercode, newuserid); message.alternateviews.add(alternateview.createalternateviewfromstring(html, new contenttype("text/html")); message.alternateviews.add(alternateview.createalternateviewfromstring(plain, new contenttype("text/plain"));
see how google treats message. in gmail, open test message you've sent, click downfacing arrow next reply button, , select "show original". you'll see how google treated message. headers like:
received-spf: softfail (google.com: domain of transitioning xxx@xxx.org not designate xx.xx.xx.xx permitted sender) client-ip=xx.xx.xx.xx; authentication-results: mx.google.com; spf=softfail (google.com: domain of transitioning xxx@xxx.org not designate xx.xx.xx.xx permitted sender)
read on default rule set spamassassin reference on rule sets filters. if can identify why message getting flagged, can fix it.
Comments
Post a Comment