Email Not Set

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);
}

}
 
G

Guest

After reviewing the sample you provided, I changed the following code:

MailMessage message
= new MailMessage("(e-mail address removed)",
"(e-mail address removed)", "subject of the Message ",
"body fo the message ");

To:
MailMessage message = new MailMessage();
message.From = new MailAddress ("(e-mail address removed)",
"Dobbs-Stanford Sales");
message.To.Add("(e-mail address removed)");
message.Subject="subject of the Message";
message.Body="body of the message";

I am getting the same results, "Failure to Send".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top