Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to send a confirmation email in asp.net, cannot get IIS pickup directory error
    primarykey
    data
    text
    <p>I want to send a confirmation email to user in registration page. The following code is the related part:</p> <pre><code>try { SmtpClient sc = new SmtpClient(); System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); string Ema = u.UserMail.ToString(); MailAddress gonderen = new MailAddress("admin@gmail.com", "Hello"); sc.Host = "smtp.gmail.com"; sc.Port = 587; mail.To.Add(Ema); mail.Subject = "Confirmation Message"; mail.From = gonderen; mail.IsBodyHtml = true; mail.BodyEncoding = System.Text.Encoding.GetEncoding("ISO-8859-9"); mail.Body = "&lt;html&gt;&lt;body&gt;"; sc.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis; sc.Send(mail); MESSAGE(true, "Sending mail is successful"); } catch (Exception) { MESSAGE(true, "Sending mail is unsuccessful!"); } </code></pre> <p>But it does not send an email to related user. I have looked at forums and I added to web.config the following part:</p> <pre><code> &lt;system.net&gt; &lt;mailSettings&gt; &lt;smtp from="myaddress@gmail.com "&gt; &lt;network host="smtp.gmail.com" defaultCredentials="false" port="587" userName ="myaddress@gmail.com" password="password" /&gt; &lt;/smtp&gt; &lt;/mailSettings&gt; &lt;/system.net&gt; </code></pre> <p>But anything didn't change. Then i have debugged and it enters into the try statement and when it comes to <code>sc.Send(mail);</code>, it drops to catch. Where is my mistake?</p> <p>Additionally, during debug i realized that it shows this error: <code>cannot get IIS pickup directory</code>. I have controlled whether I have a smtp service or not from services but i couldn' t see this service. Is this error related to that service?</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload