I'm working with a program that can send email supporting yahoo mail and gmail. And it works in gmail(if the sender utilizes gmail) But it won't work if the sender is using yahoo mail. Here is my code:
mail.From = New MailAddress(TextBox2.Text)
mail.To.Add(New MailAddress(TextBox1.Text))
mail.Subject = TextBox4.Text
mail.Body = TextBox4.Text
mail.IsBodyHtml = True
Dim client2 As SmtpClient = New SmtpClient("smtp.mail.yahoo.com", 25)
Dim client As SmtpClient = New SmtpClient("smtp.gmail.com", 587)
client.EnableSsl = True
client.Credentials = New System.Net.NetworkCredential(TextBox2.Text, TextBox3.Text)
Try
client.Send(mail)
Catch ex As Exception
MessageBox.Show("Sending email failed. Please Try again")