Click here to Skip to main content
15,886,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application, I need to upload a document and after it is uploaded, a mail haas to be send to a particular id. for this i did the coding. there is no error and the document is uploded but sending mail portion is not working. the mail sending portion is like this

MailMessage message = new MailMessage();
                        message.From = new MailAddress("from");
                        message.To.Add("to");
                        message.Subject = "Test mail";
                        message.Body = " This is a test ";
                        message.IsBodyHtml = true;
                        string smtpUrl = web.Site.WebApplication.OutboundMailServiceInstance.Server.Address;
                        SmtpClient smtp = new SmtpClient(smtpUrl);
                        smtp.Send(message);

Pls help me if you know the reason.

Thanks
Posted
Updated 27-Feb-12 0:23am
Comments
Dylan Morley 27-Feb-12 6:23am    
"it's not working." is not enough information for anyone to help you.

If you have an exception, post the full Exception details. Use 'Improve Question' and post the details underneath your code
Rajesh Anuhya 27-Feb-12 6:24am    
Edited: Code tags added.

Hi,

You have missed major setting like "POP,SMTP" see my answer Here[^]

Search in Google/CP before posting Question.

Thanks
--RA
 
Share this answer
 
Check whether SMTP service is enabled on the machine and make sure it's properly configured in Central Admin. Just navigate to Central Admin --> System Settings --> Configure outgoing e-mail settings under E-Mail and Text Messages (SMS) section.
 
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