Sending mail with a Yahoo server

Before you advise to use Mailgun or Mandril instead, I need to explain why I want to specifically use Yahoo.

I send customers download instructions when they purchase on my sites. Some chime in saying they did not receive the mail. It is because GMail, AOL or Yahoo has thrown the mail into the spam folder.

To avoid that problem, I will send the download instructions twice ; once from my own server, and the second one from the same service as their own. AOL for AOL users, GMail for GMail users, and if possible, Yahoo for Yahoo users.

AOL and GMail work just fine, but I keep getting an error with Yahoo. I tried setting SMTPSecureSocket to SSL 3, to TLS, whatever, no joy. All I get is a socket error.

Has anybody succeeded ? If so, I’ll appreciate some pointers. TIA.

Just FYI, those services do work to stay off the spam filter lists, so they may solve your problem anyway.

Question:

Do you have two factor auth for Yahoo Enabled?
If yes you would have to use an App-Specific Passwort (the normal one will not work for POP3 / Imap and SMTP Access)

No, I do not have two-step verification.

What puzzles me is that I can send mail just fine from Thunderbird, but when I use the very same settings in Xojo the connection never happens.

The only special thing I know about Yahoo is for IMAP. I can do some testing tomorrow with Yahoo.

The last time I tested, Yahoo Mail required smtp.mail.yahoo.com, TLSv12, ModeSSLTLS and 465 for Address, ConnectionType, SMTPConnectionMode and Port when using SMTPSecureSocket.

I believe these are the settings I use :

theMailServer = New mySMTPSecureSocket theMailServer.Address = "smtp.mail.yahoo.com" theMailServer.Port = 465 theMailServer.Username = "authentic.matchsoftware@yahoo.com" theMailServer.Password = p theMailServer.SMTPConnectionMode = 1 theMailServer.ConnectionType = 5

[code] mail.fromAddress = “authentic.matchsoftware@yahoo.com
dim body as string
mail.subject = “Order download instructions”
body = “download_instructions”
mail.bodyPlainText = body
mail.headers.appendHeader “X-Mailer”,“SMTP Service”
mail.AddRecipient “desk@fontmenu.com

app.theMailServer.messages.append mail

app.theMailServer.sendMail[/code]

What is strange is that basically nothing happens. No connection, no server error. Just after a long while a socket error. As if the server did not even respond.

What’s the error code?

It is not a server error. It is simply a socket error. I don’t know if there is an error number or how to get it.

Doesn’t yahoo charge for non-webmail access? Could that be a problem?

No, that is not the case. Yahoo can be used from other clients such as Apple Mail without any extra. Once again, it works perfectly well with Thunderbird with the same settings on the same machine.

Self.LastErrorCode should give you that.

Thank you Greg. Self.LastErrorCode reports 102.

[quote=270613:@Michel Bujardet]I believe these are the settings I use :

theMailServer = New mySMTPSecureSocket theMailServer.Address = "smtp.mail.yahoo.com" theMailServer.Port = 465 theMailServer.Username = "authentic.matchsoftware@yahoo.com" theMailServer.Password = p theMailServer.SMTPConnectionMode = 1 theMailServer.ConnectionType = 5

[code] mail.fromAddress = “authentic.matchsoftware@yahoo.com
dim body as string
mail.subject = “Order download instructions”
body = “download_instructions”
mail.bodyPlainText = body
mail.headers.appendHeader “X-Mailer”,“SMTP Service”
mail.AddRecipient “desk@fontmenu.com

app.theMailServer.messages.append mail

app.theMailServer.sendMail[/code]

What is strange is that basically nothing happens. No connection, no server error. Just after a long while a socket error. As if the server did not even respond.[/quote]
Just tested again successfully. Is your Yahoo Mail account configured to permit “less secure apps”? If not, you should receive an error message indicating that the username and/or password are incorrect. Have you tried without the @yahoo.com as part of the Username? Have you tried AppendHeader "Content-Type", "text/plain; charset=us-ascii" or whatever character set you’re using? They are some of the differences I see when comparing your code to mine. Hopefully one of them helps.

Less secure : Yes
username without extension : Yes
AppendHeader “Content-Type”, “text/plain; charset=us-ascii” Yes

Also tried AppendHeader “Content-Type”, “text/plain; charset=UTF8”

Still no joy, the socket fails with error 102.

Frederick, could you post the test project that works for you ? I would appreciate that very much.

Wild guess here - do you need to explicitly set the socket’s secure property to true in your code?

Yes you do and that’s probably the issue. It’s a difference in our code that I overlooked.

SMTPSecureSocket.Secure = True

Superb :slight_smile: :slight_smile: :slight_smile: It works :slight_smile: :slight_smile: :slight_smile:

Thank you so much Peter for asking the right question, and Frederick for providing the code.

I have used Xojo.Net.HTTPSocket for too long, which switches automatically, and forgot about the need to explicitly set secure in classic.

This is probably not the best way to go about it. Remember especially for Google but in some cases Yahoo that they manage domains that are not recognizable. Yahoo hosts some domains but they also have alternate domains like rocketmail.com. Google Apps for business manages thousands of domains if not hundreds of thousands of domains. Keying off the domain field alone is going to produce inaccurate results.

The user experience of receiving two different emails from two different providers is a little off putting as well and not one I ever experienced. With Mailgun and others you can request a dedicated IP address so that you build your reputation. For all you know its not the content of the message but poor timing with other spam authors using the same service.

Perhaps though it is the content of the email message like keywords, HTML fragments, etc. that are setting off the spam alarms. Yahoo like any large provider will still scan for spam inside their network as they know many bot and spam operators are operating within their environment. Most spam sending machines are legitimate accounts that have been compromised.

If your email is hitting the spam folder you need to re-evaluate that email and whats setting it off in my opinion. This action is very much the same action a spammer would take.

I do not suggest you are a spammer as I know you are not. I am merely indicating that this line of thinking does not improve the email deliverability issue as a whole and probably will not have a satisfactory success rate to be worth your time. Sadly I do not have any immediate suggestions to improve your situation other than to acquire a dedicated IP, convert your emails to text based, and be very mindful of any words or statements that are spam-like. There are resources on the web for improving deliverability rates.

Thank you Phillip.