Unable to send emails using Yahoo SMTP wtih Rebex component

0 votes
asked Jun 29, 2016 by Ftp (300 points)
edited Jun 29, 2016 by Lukas Matyska

Unable to send emails using Yahoo SMTP wtih Rebex component

Following are the details

SMTP Server: smtp.mail.yahoo.com OR smtp.bizmail.yahoo.com
Username: sparshaims360@yahoo.com
Password: *********
Port No: Not mentioning the port number
sample code: We are using the below sample code,

Imports Rebex.Net
Imports Rebex.Mail
Imports Rebex.Mime.Headers

Module Module1
Sub Main()
Dim mail As New Rebex.Mail.MailMessage()
mail.From = New Rebex.Mime.Headers.MailAddressCollection("sparshaims360@yahoo.com")
mail.To = New Rebex.Mime.Headers.MailAddressCollection("dinakarkulkarni@sparshcom.net")
mail.Subject = "This is a simple message"
mail.BodyText = "Hello, Joe!"
mail.BodyHtml = "Hello, Joe!"
Dim smtp As New Rebex.Net.Smtp()
smtp.Login("sparshaims360@yahoo.com", "***")

End Sub
End Module

We are getting the following error with the above code.

SmtpException was unhanled. "None of the supported authentication methods is accepted by the server."

Please help us to resolve the issue.

Thanks & Regards
Naga Suresh D

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Jun 29, 2016 by Lukas Matyska (59,010 points)


Yahoo requires SSL connection. Please specify SslMode.Implicit in the connect method like this:

smtp.Connect("smtp.mail.yahoo.com", Rebex.Net.SslMode.Implicit)

If no SslMode is specified, unsecured (no SSL) connection is performed and port 25 is used. However, port 25 is used for communication between servers, not for communication between client and server.

See Connecting to servers article for more details about ports and SSL modes.

commented Jun 29, 2016 by Ftp (300 points)
After applying the above changes,we are getting the below error,we checked the username and password they are correct.
(#MBR1212) Incorrect username or password (535).
commented Jun 29, 2016 by Lukas Matyska (59,010 points)
edited Jul 19, 2016 by Lukas Matyska
It is because using username and password is considered as unsecure in nowadays. To be able to use it, you have to "Allow apps that use less secure sign in". You can allow it at https://login.yahoo.com/account/security#less-secure-apps

Alternativelly, don't use username/password. Instead, use more secure method such as OAuth. Here is a sample code for using OAuth with Gmail  http://blog.rebex.net/howto-authenticate-gmail-rebex-oauth/