Hi there,
I have been trying to figure out how to connect to gmail via SMTP to send myself a message as a test, but it seems that no matter what options I try, I always get a response back similar to this:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
5.5.1 Can't sign in to your Google Account - Gmail Help
I’m using some very simple code, and my understanding based on what I’ve read in the forums is that this is correct:
//Declare message as MailMessage instance
MailMessage message = new MailMessage();
//Here is the sender’s address
message.From = “”; // I use my gmail address
//Here is the recipient’s address
message.To = “”; // I use my gmail address
message.Subject = “Test e-mail”;
//Here is the email message
message.TextBody = “A test email from the Aspose client”;
//Send email using SmtpClient
//Create an instance of the SmtpClient Class
SmtpClient client = new SmtpClient(“smtp.gmail.com”, Aspose.Email.SecurityOptions.SSLExplicit);
//Specify your mail user name
client.Username = “”; // My gmail address
//Specify your mail password
client.Password = “”; // My gmail password
//Specify your Port #
client.Port = 587;
client.Send(message);
I have tried turning on Authentication, I’ve also tried “GetCapabilities” to make sure it was working (and those return values and acceptable login types). I am out off ideas.
Additionally, the first time I tried this, I received an email from Gmail itself saying that it blocked an attempt to access my mailbox from an insecure device and to use the Gmail app instead. I DID select the option to say it was my device but it doesn’t matter, it still blocks it.
Help!
Thank you.