Today, I learned how to fix an on-going bug I've been noticing with JMail. When emails are sent from a web page using JMail, I notice that some recipients (including Gmail) flag it as a spam.
The irritating part about this bug is that it's been inconsistent, required rigorous testing from our end, and the wasted time consumed scouring the web and reading Dimac's (builder of Jmail) practically empty forums. It took awhile to determine what exact scenario caused this problem. Is it the recipient? The data center? The mail server? The mail server software? The web server? The mailer object?
Close to 4:00 AM this morning, I figured the fix! The stupid thing about this whole mess is that the fix was so simple: Use localhost instead of the smtp domain address. Thus, here's the code to use (red means you modify it based on your values):
Set Mailer = Server.CreateObject("JMail.Message")
Mailer.SimpleLayout = true
Mailer.ISOEncodeHeaders = false
Mailer.Logging = true
Mailer.Silent = true
Mailer.From = "Firstname Lastname"
Mailer.FromName = "Firstname Lastname"
Mailer.ReplyTo = sender@websiteaddress.com
Mailer.AddRecipient recipient@websiteaddress.com, "Firstname Lastname"
Mailer.Subject = "My email subject"
Mailer.HTMLBody = "My message."
If Mailer.Send(localhost) Then
mailer_status = 1
Else
mailer_status = 0
End If
Set Mailer = Nothing
Friday, September 7, 2007
Subscribe to:
Post Comments (Atom)
1 comments:
thanks for your working results, and i'll try, good job man!
Post a Comment