简体   繁体   中英

What am I missing? My app can send e-mail via gmail on my dev box, but not on my server

  • My config files are identical, except for connection strings.
  • I'm using IIS on both machines
  • I elevated the IIS user on the server to ensure it's not a permissions issue
  • No exceptions are thrown on my server where the e-mails are not being sent
  • I know the gmail configs are correct because I can send e-mails from my dev box.
  • Windows firewall is off and the network firewall is not blocking outbound ports.

What else should I look for?

IIS 7 on Win2k8, using ASP.NET w/ C#

SmtpClient smtpClient = new SmtpClient();
smtpClient.EnableSsl = true;
smtpClient.Send(fromAddress, toAddress, subject, body);

wrap smtpClient.Send(fromAddress, toAddress, subject, body); inside a try catch statment and see what the exception is

Gmail requires authentication from the SMTP client, so you need to fill in the Credentials property on your SmtpClient instance as shown here .

That doesn't explain why it works from your development box (unless the POP3 method still works) but it would explain why the code you have shown doesn't work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM