Send Mail

Posted by Vineeth1311 under ASP.NET on 9/27/2007 | Views : 1951 | Status : [Member] | Replies : 4
i need code to send emails from asp.net with c# using framework 1.1




Responses

Posted by: Sheonarayan on: 9/28/2007 [Administrator] HonoraryPlatinum

Up
0
Down
Hi Vineeth,

There is one article on this site itself http://www.dotnetfunda.com/articles/article7.aspx

Other than that you may visit following links
http://www.codeproject.com/useritems/Email_Sending_Programme.asp
http://www.developer.com/net/asp/article.php/3096831
http://codebetter.com/blogs/john.papa/archive/2005/09/19/132248.aspx

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Vineeth1311, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gnkt4ujt2002 on: 10/30/2007 [Member] Starter

Up
0
Down
Dim mailMsg As New MailMessage
Try
 mailMsg.To = "gnkt4ujt2002@gmail.com"

mailMsg.From = "u@gmail.com"
' mailMsg.To = "6@dweb.com"
' mailMsg.From = "tgtbr@dweb.com"
'mailMsg.BodyFormat = MailFormat.Text 'optional for sending text in body
mailMsg.BodyFormat = MailFormat.Html
mailMsg.Subject = "Statistics Report"
mailMsg.Body = "<html><body><Table><tr><td>Hi,</td></tr><tr><td>Details of the Statistics :</td></tr></Table></body></html><html><body>" & "sometext" & _
"</body></html><html><body><Table><tr><td> </td></tr><tr><td>NOTE: This is an automated mail. Please, do not reply.</td></tr>" & _
"<tr><td>*Green coloured rows indicates temporary demos</td></tr>" & _
"<tr><td>**All statistics are based on the page naming conventions Eg., 22_10_2005_</td></tr>" & _
"<tr><td> </td></tr><tr><td>Regards,</td></tr><tr><td>some text,</td></tr><tr><td>some text,</td></tr>" & _
"<tr><td> Some text </td></tr></table></body></html>"
' SmtpMail.SmtpServer = "10.0.0.3"
SmtpMail.Send(mailMsg)
Response.Write ("Your message has been sent")
Catch ex As Exception
Response.Write(ex.Message)
End Try


Vineeth1311, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bubbly on: 2/18/2010 [Member] Bronze

Up
0
Down
Hello,

check this link

http://kb.discountasp.net/KB/a363/how-to-send-email-in-aspnet-11.aspx

++
Thanks & Regards,
Deepika

Vineeth1311, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 11/15/2011 [Member] Starter | Points: 25

Up
0
Down
http://sandeep-chourasia.blogspot.com/2011/05/send-mail-in-aspnet.html


just use your code like this
protected void btnsubmit_Click(object sender, EventArgs e)

{
if (Page.IsValid)
{
string StrMailBody = "Name: " + txtname.Text.ToString().Trim() + ", Contact No.: " + txtcont.Text.ToString().Trim();
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;

// setup Smtp authentication
System.Net.NetworkCredential credentials =
new System.Net.NetworkCredential("emailid", "pwd");
client.UseDefaultCredentials = false;
client.Credentials = credentials;

MailMessage msg = new MailMessage();
msg.From = new MailAddress("emailid");
msg.To.Add(new MailAddress("receiver emaid id "));
//msg.CC.Add(new MailAddress("email"));
msg.Bcc.Add(new MailAddress("sandeepchrs@yahoo.com"));

msg.Subject = "SMWS - Contact Us";
msg.IsBodyHtml = true;
msg.Body = string.Format("<html><head></head><body><b>Name: </b>" + txtname.Text.ToString().Trim() + "<b>Contact us: </b>" + txtcont.Text.ToString().Trim() + "</body>");

try
{
client.Send(msg);
//lblMsg.Text = "Your message has been successfully sent.";
}
catch (Exception ex)
{
//lblMsg.ForeColor = Color.Red;
//lblMsg.Text = "Error occured while sending your message." + ex.Message;
}
}
}


ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Vineeth1311, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response