0
ASP.netでSMTP経由で電子メールを送信しようとしていますが、電子メールは送信されず、エラーは発生しません。私のコード:ASP.netでSMTPを使用して電子メールを送信しない
//create the mail message
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
//set the FROM address
mail.From = new MailAddress("[email protected]");
//set the RECIPIENTS
mail.To.Add("[email protected]");
//enter a SUBJECT
mail.Subject = "Set the subject of the mail here.";
//Enter the message BODY
mail.Body = "Enter text for the e-mail here.";
//set the mail server (default should be smtp.1and1.com)
SmtpClient smtp = new SmtpClient("smtp.1and1.com");
//Enter your full e-mail address and password
smtp.Credentials = new NetworkCredential("[email protected]", "xxxxxxx");
//send the message
smtp.Send(mail);
そしてweb.configファイルで私のコードは、各パラメータの値を表示する
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:\Mail\" />
</smtp>
</mailSettings>
<defaultProxy enabled="true" />
</system.net>
あなたのSMTPポートが塞がれているか、資格情報が、私はのtry/catchを使用したが何も間違っては検出されません –