Click here to Skip to main content
11,718,589 members (87,276 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 4-Oct-12 1:40am
cunny301
Edited 4-Oct-12 1:53am
_Amy53.3K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

use This Code
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
  Permalink  
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
Smile | :)
  Permalink  
Comments
shambhoo kumar at 4-Oct-12 7:55am
   
sorry dear this is a wrong link....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

HI

Here are the default email ports for:


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";
}
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 215
1 F-ES Sitecore 210
2 Maciej Los 140
3 Jochen Arndt 120
4 Andy Lanng 115
0 OriginalGriff 535
1 Maciej Los 529
2 Richard MacCutchan 440
3 CHill60 415
4 F-ES Sitecore 415


Advertise | Privacy | Mobile
Web02 | 2.8.150901.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100