G
Guest
Using .NET 2.0 in Visual Studio 2005, I am attempting to send an email. I am
utilizing Yahoo as the SMTP provider. I am able to send emails using the
setup instructions below using Outlook. When I attempt to send an email
using C#, I get a message that no email was sent.
I have included the section of C# that covers this issue.
Configure your POP email program.
Sign-in Information
Server Settings
username - (e-mail address removed)
password - myPassword
Incoming Mail (POP3)
pop.bizmail.yahoo.com
Use SSL, port: 995
Outgoing Mail (SMTP)
smtp.bizmail.yahoo.com
Use SSL, port: 465; authentication required
As soon as you set up your account, you can start sending and receiving
messages from your new email address!
public static void SendEmail()
{
/* create the email message */
MailMessage message
= new MailMessage("(e-mail address removed)",
"(e-mail address removed)", "subject of the Message ",
"body fo the message ");
/* create SMTP Client and add credentials */
SmtpClient smtpClient = new SmtpClient();
smtpClient.Port = 465;
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials
= new NetworkCredential("(e-mail address removed)",
"myPassword");
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.Host = "smtp.bizmail.yahoo.com";
smtpClient.PickupDirectoryLocation = "C:\\Temp";
/*Send the message */
try
{
smtpClient.Send(message);
}
catch (System.Net.Mail.SmtpException e)
{
MessageBox.Show(e.Message);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
utilizing Yahoo as the SMTP provider. I am able to send emails using the
setup instructions below using Outlook. When I attempt to send an email
using C#, I get a message that no email was sent.
I have included the section of C# that covers this issue.
Configure your POP email program.
Sign-in Information
Server Settings
username - (e-mail address removed)
password - myPassword
Incoming Mail (POP3)
pop.bizmail.yahoo.com
Use SSL, port: 995
Outgoing Mail (SMTP)
smtp.bizmail.yahoo.com
Use SSL, port: 465; authentication required
As soon as you set up your account, you can start sending and receiving
messages from your new email address!
public static void SendEmail()
{
/* create the email message */
MailMessage message
= new MailMessage("(e-mail address removed)",
"(e-mail address removed)", "subject of the Message ",
"body fo the message ");
/* create SMTP Client and add credentials */
SmtpClient smtpClient = new SmtpClient();
smtpClient.Port = 465;
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials
= new NetworkCredential("(e-mail address removed)",
"myPassword");
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.Host = "smtp.bizmail.yahoo.com";
smtpClient.PickupDirectoryLocation = "C:\\Temp";
/*Send the message */
try
{
smtpClient.Send(message);
}
catch (System.Net.Mail.SmtpException e)
{
MessageBox.Show(e.Message);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}