944,183 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 2264
  • C# RSS
Apr 17th, 2007
0

I need a code for sending e-mail

Expand Post »
Hello,
Could you please help me in writing a code for sending an e-mail in c#...

Regards..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
noora000 is offline Offline
7 posts
since Mar 2007
Apr 17th, 2007
1

Re: I need a code for sending e-mail

Have you written any code yet? If not do so as we do not do work for you. We are only here to help if you have a problem. So write some code and if you have a specific question or problem post it here with your code and we will try to help you. Otherwise you will need to hire someone to do this work for you.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Apr 17th, 2007
0

Re: I need a code for sending e-mail

Sure I worked on it before, but because I am new for c# I faced many problems,

System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();
message.From="from e-mail";
message.To="to e-mail";
message.Subject="Message Subject";
message.Body="Message Body";
System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address";
System.Web.Mail.SmtpMail.Send(message);

for example this code it does not work,,
Reputation Points: 10
Solved Threads: 0
Newbie Poster
noora000 is offline Offline
7 posts
since Mar 2007
Feb 25th, 2010
0
Re: I need a code for sending e-mail
Try out this code.

C# Syntax (Toggle Plain Text)
  1. System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
  2. //message.To.Add("xxxx@gmail.com");
  3. message.Subject = "Rental Agreement Form";
  4. message.From = new System.Net.Mail.MailAddress("user@msssoftware.com");
  5. message.To.Add("xxxx@gmail.com");
  6. //message.CC.Add("xxxx@gmail.com");
  7. message.IsBodyHtml = true;
  8. message.Body = result;
  9. System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 25);
  10. smtp.Host = "localhost";
  11. smtp.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
  12. smtp.Send(message);
  13. Label3.Text = "Mail sent Successfully";
Last edited by adatapost; Feb 25th, 2010 at 10:00 am. Reason: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).
Reputation Points: 10
Solved Threads: 0
Newbie Poster
maryjessicka is offline Offline
2 posts
since Feb 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Want to ask about input automation
Next Thread in C# Forum Timeline: barcode reading through scanned jpg image





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC