Click here to Skip to main content
15,888,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a mail and pager message sending problem in my project but it is only when i access the hosted site.


When i debug the project form visual studio it is working perfectly.

Please provide your valuable feedback


DO you have any suggestion.



regards,
Shefek
Posted
Updated 10-Oct-12 20:58pm
v2
Comments
Sushil Mate 11-Oct-12 3:05am    
you need to setup the smtp server on your server,
shefeekcm 11-Oct-12 3:29am    
how can do that

1 solution

Hope this link helps.

Configure SMTP E-mail (IIS 7)[^]

Quote:
1. start->administrative tools->server manager, go to features, select "add features", tick "smtp server" (if it is not already installed), choose to install the required "remote server admin toos"

2. check to confirm that "Simple Mail Transfer Protocol (SMTP)" service is running, if so, we are good to go.

3. start->administrative tools>internet info services(iis) 6.0

4. make sure that SMTP virtual server/default smtp server is running, if not, right click, then choose "start"

5. in IIS7, go to website/virtual directory, double click "SMTP E-mail", Click on "Deliver e-mail to SMTP server", check the "Use localhost" checkmark

6.Your code should be LIKE:

SmtpClient serv = new SmtpClient();
MailMessage msg = new MailMessage();
msg.To.Add("toadrr@domain.com);
msg.Body = "body";
msg.Subject = "subj";
msg.BodyEncoding = System.Text.Encoding.ASCII;
msg.IsBodyHtml = isHTML;
serv.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
serv.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["SmtpServerUserName"], ConfigurationManager.AppSettings["SmtpServerPassword"]);
serv.Send(msg);



--->My app is now sending emails. The first email spent about 30 min in the Queue folder, but after that, each email is sent straight away. (this is working for testing purposes, i am not sure if i should use this setup in a production environment - please advise)
 
Share this answer
 
v2
Comments
shefeekcm 11-Oct-12 5:27am    
still it is not working...........
Sushil Mate 11-Oct-12 5:28am    
what's the error?
shefeekcm 11-Oct-12 5:31am    
it does not give any error but mail does not send
shefeekcm 11-Oct-12 5:32am    
we have some other sites like this.But we did not do any settings like this in iis.
Sushil Mate 11-Oct-12 5:52am    
can you put the code here?

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