Mail Service Issue

I am having an issue with mail in production. I tried just sending a straight cfmail from/to and the email was sent just fine. When ever one of my notifications go out from my new application the email gets put in the undelivered folder. If I look at the logs I see an exception reading message? (see attachment 1) and If I look at the message it looks like its trying to use smtp.gmail.com:25 even though I have set 465 as the outgoing port. Any ideas?

Where did you set the port? Did you set it in the payload or in your mail settings structure in your config?

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

This is just set in my server settings. Do I need to set this up in Coldbox?

Dan,

From memory, as I haven’t looked into the plugin code for sometime.

If you don’t define the settings in ColdBox then it uses the CF server settings, you might need to double check your config as it might just have some default info there.

The server is sending mail fine, that is the right info. Let me double check this plugin, maybe it uses 25 by default

Yep…that is the issue, if you don’t specify a setting it defaults to 25 and that is why my mail is not getting set. I will try and set the mail settings in the config and see if that does the trick.

Nope, still not getting sent… Exception reading response

I thought maybe it was a firewall issue so I opened up 465 outbound just to be safe but email is sending from the www side using the same settings just fine.

Is that what shows in the mail logs?

If that is the case then you are trying to send mail out through gmail / google apps and you have reached your limit on the sending of mail.

This is the error I am getting…weird because the verify connection works. I know nothing about mail though haha

“Error”,“scheduler-0”,“01/13/12”,“21:20:21”,“Exception reading response”
javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1764)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1523)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:291)
at coldfusion.mail.MailSpooler.getConnection(MailSpooler.java:1234)
at coldfusion.mail.MailSpooler.deliver(MailSpooler.java:984)
at coldfusion.mail.MailSpooler.sendMail(MailSpooler.java:905)
at coldfusion.mail.MailSpooler.deliverStandard(MailSpooler.java:1310)
at coldfusion.mail.MailSpooler.run(MailSpooler.java:1275)
at coldfusion.scheduling.ThreadPool.run(ThreadPool.java:201)
at coldfusion.scheduling.WorkerThread.run(WorkerThread.java:71)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:523)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:744)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:106)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:84)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1742)
… 10 more

If I just drop in a plain old cfmail on the server it works fine

this is a test to make sure the server is sending mail properly using the default server

another twist… error emails via logbox are getting sent just fine…

Dan,

This message is received from ColdFusion because when you try to send through the gmail network, you have exceeded your daily limit of emails, or you are relaying email through the gmail network.

I went through this with a client recently, if you google this error message you will get a number of different scenarios, but I can tell you from first hand that as soon as I switched this over to a mail server with no limitations this error went away.

You will also find that all these email will be stored in the mail->undelivr folder as well.

This has to be a Coldbox issue right? I am really confused on how to debug this…anyone got an idea?

No Dan, this is a Gmail or mail server issue.

Try getting a copy of wireShark and watch the ports for mail, and look at the handshakes/requests between the servers.

As I stated this error is generally occurring because gmail or your mail server, has rejected relaying emails. Which is why the other email address you used actually works.

Gmail is very fussy when it comes to mail relays and will only allow you to send so many a day, before it stops responding, and why you see these type of messages in the logs. Other mail servers like yahoo might do the same thing.

Andrew -
What I was saying though is I sent an email using cfmail that uses the same from/to and uses gmail server settings from ColdFusion admin to send the email. I also use these same settings on the front end of the website to send email from a Mura website. This is why I don’t think its a Gmail issue.

Hi Dan,

The stack trace you post seems to be throwing an SSL related exception.

is UseSSL flag being set anywhere in your application before the mail is dispatched, either in the service or in the payload?

Robert.

p.s. if you’re using the latest ColdBox build I’d perhaps recommend looking at postmarkapp and the protocol that comes bundled, skips the whole cfmail affair :slight_smile:

Dan,

Well then it sounds like that is a different issue then, have you tried logging / step debugging the sending of the email? I came to the conclusion as you added in another post that you tried a different email etc and it worked fine, but you didn’t add if you used a different sender name or server name.

All I can say is that the log message for no response in the mail log, is indeed a message that is always seen when you exceed your daily sending limits for mail relays.

As to your problem, my guess is that the config settings aren’t getting picked up, or the application hasn’t been reinit’ed to pick them up. Logging the details or step debugging into the code and inspecting the values would determine this further I would suspect.

I use this all the time with sending emails and have no problems with it.

@Robert - That was my thought to so I setup useSSL = true in my mail settings in my config. I will take a look at the latest build and see if its something I can use.

@Andrew - I will setup these mail parameters locally and see if I can figure out the problem, thanks!

Postmark API looks pretty cool, has anyone used it before? Thoughts? Doesn’t seem like it will cost that much so its an option. From the documentation it looks like all I need to do is add a protocol and apikey to my mail settings, nice!

mailSettings = {
	server="",
	username="",
	password="",
	protocol="coldbox.system.core.mail.protocols.FileProtocol",
        apikey = "123456789"
};