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 - info@MyCompany.com
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("info@MyCompany.com",
"ref@yourCompany.Com", "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("info@MyCompany.com",
"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);
}
}
Som Nath Shukla - 03 Oct 2007 04:17 GMT
for detail see http://sns-dotnet.spaces.live.com/
> 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
[quoted text clipped - 54 lines]
>
> }
Robert E. Flaherty - 03 Oct 2007 16:59 GMT
After reviewing the sample you provided, I changed the following code:
MailMessage message
= new MailMessage("info@MyCompany.com",
"ref@yourCompany.Com", "subject of the Message ",
"body fo the message ");
To:
MailMessage message = new MailMessage();
message.From = new MailAddress ("info@dobbsstanfordsales.com",
"Dobbs-Stanford Sales");
message.To.Add("ref@dobbsstanford.com");
message.Subject="subject of the Message";
message.Body="body of the message";
I am getting the same results, "Failure to Send".
> for detail see http://sns-dotnet.spaces.live.com/
>
[quoted text clipped - 56 lines]
> >
> > }
sloan - 03 Oct 2007 19:06 GMT
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry
Take a peek at my blog entry, and get teh downloadable example.
I have SSL and alternate port information/ability there.
My sample uses gmail/google mail, but would be a quick change to try yahoo
stuff.
> Using .NET 2.0 in Visual Studio 2005, I am attempting to send an email. I
> am
[quoted text clipped - 55 lines]
>
> }