Click here to Skip to main content
15,905,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I'm a student doing a 3rd year project and I am having trouble with sending automated emails.
I've looked at examples on this site and other sites but can't seem to get it to work.

Does someone maybe have a simple way of doing this?

I kind of need help from beginning to end, especially regarding the smtp server.

If anyone can help I'd really appreciate it.
Sorry if this is a dumb question, I'm still pretty new to asp.net :)
Posted
Updated 9-Aug-10 3:16am
v2
Comments
Dalek Dave 9-Aug-10 9:16am    
Minor Edit for Readability.
It is not a dumb question, and is phrased well.

Do you mean sending mail from the webpage on completion of a request?
 
Share this answer
 
The mail must be sent on a button click event.
Basically, i need to send an email after a record in the database has been updated and the user involved needs to receive the email notifying him of the update.

I need to obtain the content of the email from procedures within events in the program and not through values entered in textboxes.

What is the best way to send an email like this?

Thanks
 
Share this answer
 
MSDN Forum QA on net mail


Me Personal I Create a class and have properties for each type such as From, Too, CC, BCC etc rather than a big parameter list for a function or sub rountine

and pass the values from the text box into the class and then send

Hope this makes sense :-D
 
Share this answer
 
Hi,

try this

MailMessage mail = new MailMessage();
mail.To.Add("xxx@gmail.com");
mail.From = new MailAddress("yyy@gmail.com", "Hello");
mail.Subject = "this Is me";
mail.IsBodyHtml = true;
mail.Body = "Hai"; 
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential("yyy@gmail.com", "12345");
smtp.EnableSs = true;


:thumbsup:
 
Share this answer
 
v2
Thanks for the help, i got it working.
When i use localhost im able to save the message to the root folder of the program, but when i try to use my service provider's smtp server, nothing is sent although no error is given.
 
Share this answer
 

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