I have this code, used for sending emails from GMX mail to walla mail.
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
SmtpClient client = new SmtpClient();
client.Port = 25;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Host = "mail.gmx.com";
mail.Subject = "A new account was registered: ";
mail.Body = string.Format("Username: {0}, Password: {1}", textBox1.Text, textBox2.Text);
try
{
client.Send(mail);
}
catch (SmtpException ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
Whenever I try running that code, I get an exception that I need a secured connection, but I have enabled SSL. What didn't I do properly? Thanks!
As mentioned on GMX page you must use port 587 when you use SSL/TLS connection: https://help.gmx.com/en/applications/pop3.html
I think you should also set the credentials to authentication to the SMTP client using the credentials for your mail account: