[Closed] Send an e-mail with dotnet
Hey there!
I followed a tutorial about sending an e-mail with dotnet, but it doesn’t seem to work:
local FromAdress = “MYMAIL@gmail.com“
local ToAdress = “CLIENTMAIL@gmail.com“
local password = “azerty”MailMessage = dotNetObject “System.Net.Mail.MailMessage”
MailAdressFrom = dotNetObject “System.Net.Mail.MailAddress” FromAdress
MailMessage.From = MailAdressFrom
MailAdressTo = dotNetObject “System.Net.Mail.MailAddress” ToAdress
MailMessage.To.Add MailAdressTo
MailMessage.Subject = “Hey there”
MailMessage.Body = “is this working”Client = dotNetObject “System.Net.Mail.SmtpClient”
Client.Host = “smtp.gmail.com”
Client.EnableSsl = true;
NetworkCred = dotNetObject “System.Net.NetworkCredential”
NetworkCred.UserName = FromAdress
NetworkCred.Password = password
Client.UseDefaultCredentials = true
Client.Credentials = NetworkCred
Client.Port = 587
Client.Send MailMessage
When I launch this script, this is what I got:
– Runtime error: .NET runtime exception: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at
Can you help me out with this please?
Thank you!