×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

Send email though ASP. NET?

本文发表在 rolia.net 枫下论坛Thanks for those people who replied my last post regarding the problem of sending email through ASP .NET application. Your answers really help me. I got one step further: I couldn't send email from ASP .NET application through our company's mail server a few days ago, I found the problem was that anti-virus software in my local computer blocked port 25. The ASP .NET application in my local computer for sending email is now working, but only for internal email address. I would like to ask the following:
1. When I moved this application to web server, it didn't work again. FYI, web server is the same computer where the mail server is. Could the port 25 be blocked same as my local computer? I don't have access to web server, so I couldn't see anything on web server. What other possible reasons?
2. Sending email only works for internal email address, but not for external email address. Sending to external email gave me the error saying Policy rejection to target address...Could this cause by SMTP configuration on mail server?
3. Our system admin said he tested mail server through MS Outlook, it works for external email. If it works for MS Outlook, but it doesn't work for ASP .NET application. What reasons could be?

Thanks for any reply.更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / Send email though ASP. NET?
    本文发表在 rolia.net 枫下论坛Thanks for those people who replied my last post regarding the problem of sending email through ASP .NET application. Your answers really help me. I got one step further: I couldn't send email from ASP .NET application through our company's mail server a few days ago, I found the problem was that anti-virus software in my local computer blocked port 25. The ASP .NET application in my local computer for sending email is now working, but only for internal email address. I would like to ask the following:
    1. When I moved this application to web server, it didn't work again. FYI, web server is the same computer where the mail server is. Could the port 25 be blocked same as my local computer? I don't have access to web server, so I couldn't see anything on web server. What other possible reasons?
    2. Sending email only works for internal email address, but not for external email address. Sending to external email gave me the error saying Policy rejection to target address...Could this cause by SMTP configuration on mail server?
    3. Our system admin said he tested mail server through MS Outlook, it works for external email. If it works for MS Outlook, but it doesn't work for ASP .NET application. What reasons could be?

    Thanks for any reply.更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • If u r using IIS, then use its default SMTP Vitual Server? You put "localhost" as your network host in your smtp setting in web.config. Your smtpclient gets the settings automatically. You need to configure the smtp serivice and set up the smart host.
    • Please show your code. It might help people to find the problem.
    • there is few possibility.
      1,The way SMTP authorized sender,
      2,SMTP could use other port other then 25,
      3.your web server didn't register in DNS and exchange server check dns record for validting sender.
    • on your local machine, if you can send mail through company mail server to internal email address, but not external email address, that's a relay issue.
      本文发表在 rolia.net 枫下论坛normally smtp server works like this:

      it accept any mails belong to itself ( internal email);
      if the mail is external email, it will check if the sender is trusted ( by ip or by user authentication ) then relay the email.

      the best way to decide what's the problem is do something on your local machine like

      telnet smtpserver 25
      helo xxx.yourdomain.com
      mail from:you@yourdomain.com
      rcpt to:sombody@hotmail.com
      data
      xxx
      .

      smtp server will tell you the reason why it refuse to relay.

      but you need some knowledge for smtp protocol.

      sending mail by outlook ok probably means outlook is using user authentication.

      deep blue already give you the solution in his previous post, check smtp Credential.

      If it doesn't work on web server, you have to have permission to check it on web server.

      anything could go wrong, internal firewall might block it, it might not even listening on 127.0.0.1. Web.config might be wrong ( usually you put smtp ip into web.config), you see the smtp server as 192.168.111.111 on your local machine, but it might not be the case on web server.更多精彩文章及讨论,请光临枫下论坛 rolia.net
    • Sending internal email is working on web server now.
      Sending internal email is working on web server now. Our system admin fixed the problem on web server right after I told him how I fixed the problem (port 25 was blocked by virus scan software) with my local machine. The problem right now is that sending external email failed with error message "Policy reject to target address..."