Click here to Skip to main content
15,894,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
public void Sendmail(string uemail)
    {

MailMessage loginInfo = new MailMessage();
        loginInfo.To.Add(uemail);
        loginInfo.From = new MailAddress("zzz@gmail.com");
        loginInfo.Subject = "Forgot Password Information";

        loginInfo.Body = "Username: " + dspwd.Tables[0].Rows[0]["Username"] + "<br><br>Password: " + dspwd.Tables[0].Rows[0]["user_password"] + "<br><br>";
        loginInfo.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com";
        smtp.Port = 587;
        smtp.EnableSsl = true;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.UseDefaultCredentials = false;
       smtp.Credentials = new System.Net.NetworkCredential("xyz@gmail.com","*******");
        smtp.Send(loginInfo);
}

[Edited : Added code tag. - Amit]
Posted
Updated 4-Oct-12 1:53am
v2

use This Code
C#
MyMsg = New MailMessage(StrFrom, StrTo, StrSubject, StrBody);
MyMsg.IsBodyHtml = True;
MySmtp = New SmtpClient("localhost");
MySmtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
MySmtp.Send(MyMsg);

dont use port name or use port 50
 
Share this answer
 
v3
Click this link

http://en.allexperts.com/q/Active-Server-Pages-1452/Save-asp-form-pdf.htm[^]

i hope this link really help u..

Regard
Sham
:)
 
Share this answer
 
Comments
Shambhoo kumar 4-Oct-12 7:55am    
sorry dear this is a wrong link....
HI

Here are the default email ports for:


C#
if (EmailId.Contains("gmail"))
{
server = "smtp.gmail.com";
port = "465";
}
else if (EmailId.Contains("yahoo"))
{
server = "smtp.mail.yahoo.com";
port = "465";
}
else if (EmailId.Contains("hotmail"))
{
server = "smtp.live.com";
port = "25";
}
else if (EmailId.Contains("aol"))
{
server = "smtp.aol.com";
port = "465";
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900