専用サーバーの IIS6 SMTP を使用して ASP.NET からメールを送信するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/97840

  •  01-07-2019
  •  | 
  •  

質問

ローカル IIS SMTP サーバー経由でメールを送信するように ASP.NET を実行する専用サーバーを構成しようとしていますが、メールがキュー フォルダーに滞留し、配信されません。

.aspx ページでこのコードを使用してテストしています。

<%@ Page Language="C#" AutoEventWireup="true" %>

<% new System.Net.Mail.SmtpClient("localhost").Send("info@thedomain.com", 
    "jcarrascal@gmail.com", "testing...", "Hello, world.com"); %>    

次に、Web.config ファイルに次の内容を追加しました。

<system.net>
  <mailSettings>
    <smtp>
      <network host="localhost"/>
    </smtp>
  </mailSettings>
</system.net>

IIS マネージャーで、「既定の SMTP 仮想サーバー」のプロパティを次のように変更しました。

General: [X] Enable Logging
Access / Authentication: [X] Windows Integrated Authentication
Access / Relay Restrictions: (o) Only the list below, Granted 127.0.0.1
Delivery / Advanced: Fully qualified domain name = thedomain.com

最後に、次のように SMTPDiag.exe ツールを実行します。

C:\>smtpdiag.exe info@thedomain.com jcarrascal@gmail.com

Searching for Exchange external DNS settings.
Computer name is THEDOMAIN.
Failed to connect to the domain controller. Error: 8007054b

Checking SOA for gmail.com.
Checking external DNS servers.
Checking internal DNS servers.
SOA serial number match: Passed.

Checking local domain records.
Checking MX records using TCP: thedomain.com.
Checking MX records using UDP: thedomain.com.
Both TCP and UDP queries succeeded. Local DNS test passed.

Checking remote domain records.
Checking MX records using TCP: gmail.com.
Checking MX records using UDP: gmail.com.
Both TCP and UDP queries succeeded. Remote DNS test passed.

Checking MX servers listed for jcarrascal@gmail.com.
Connecting to gmail-smtp-in.l.google.com [209.85.199.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gmail-smtp-in.l.google.com.
Connecting to gmail-smtp-in.l.google.com [209.85.199.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [209.85.135.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [209.85.135.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt1.gmail-smtp-in.l.google.com [209.85.133.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt1.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [74.125.79.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt2.gmail-smtp-in.l.google.com [74.125.79.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt2.gmail-smtp-in.l.google.com.
Connecting to alt1.gmail-smtp-in.l.google.com [209.85.133.114] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to alt1.gmail-smtp-in.l.google.com.
Connecting to gsmtp183.google.com [64.233.183.27] on port 25.
Connecting to the server failed. Error: 10060
Failed to submit mail to gsmtp183.google.com.
Connecting to gsmtp147.google.com [209.85.147.27] on port 25.
Connecting to the server failed. Error: 10051
Failed to submit mail to gsmtp147.google.com.

ASP.NET 2.0、Windows 2003 Server、およびそれに付属する IIS を使用しています。

問題を解決するには他に何を変更すればよいか教えていただけますか?

ありがとう


@mattlant

これは専用サーバーなので、SMTP を手動でインストールします。

編集:私はExchangeを使用しているので、それは少し異なりますが、それは交換でスマートホストと呼ばれますが、SMTPサービスの構成では他の何かと呼ばれると思います。設定名を正確に覚えることはできません。

スマートホストフィールドを教えていただきありがとうございます。現在メールが配信されています。

[デフォルトの SMTP 仮想サーバー] プロパティの [配信] タブで、[詳細設定] をクリックし、プロバイダーから提供されたアドレスを [スマート ホスト] フィールドに入力します。私の場合 (GoDaddy) は k2smtpout.secureserver.net でした。

詳細はこちら: http://help.godaddy.com/article/1283

役に立ちましたか?

解決

電子メールの量にもよりますが、通常、最善の方法は、ISP の SMTP サーバー経由でメールを転送することです。頭痛が減りました。asp.net から SMTP へではなく、SMTP から外部サーバーへの問題が発生しているようです。

SMTP サーバーを ISP に送信するように設定するか、asp.net を ISP に送信するように構成することができます。

編集:私はExchangeを使っているので少し違いますが、Exchangeではスマートホストと呼ばれていますが、プレーンなSMTPサービス構成では別の名前で呼ばれていると思います。

設定名を正確に思い出せません。

他のヒント

どう見ても、ファイアウォールは SMTP (TCP ポート 25) をネットワークから排除していません。

2つの非常に明白な質問(カバーされていない場合に備えて)1。Windowsのファイアウォールは無効になっていますか?2.個人/会社のファイアウォールによってメールの送信が妨げられていませんか?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top