Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send an email from my C# codebehind - Getting System.Net.Mail.SmtpFailedRecipientException
    primarykey
    data
    text
    <p>I have a webform where someone can set up an account - I want to send them an email confirmation.</p> <p>The code I'm using:</p> <pre><code> // Create e-mail message MailMessage mm = new MailMessage(); mm.From = new MailAddress("OurOrganisationEmail@ourdomain.com", "Our Organisation"); mm.To.Add(new MailAddress("webuser@domain.com", "Web User")); mm.Subject = "Confirmation"; mm.Body = "You are now registered test"; mm.IsBodyHtml = true; // Send e-mail sc = new SmtpClient(); NetworkCredential basicAuthenticationInfo = new NetworkCredential(“OurOrganisationEmail@ourdomain.com”, “ourorganisationemailPassword”); sc.Credentials = basicAuthenticationInfo; sc.UseDefaultCredentials = false; sc.Send(mm); </code></pre> <p>web.config:</p> <pre><code>&lt;system.net&gt; &lt;mailSettings&gt; &lt;smtp&gt; &lt;network host="mail.OurOrganisationEmail@ourdomain.com" port="9999" userName="OurOrganisationEmail@ourdomain.com" password="OurOrganisationEmailPassword"/&gt; &lt;/smtp&gt; &lt;/mailSettings&gt; &lt;/system.net&gt; </code></pre> <p>But get:</p> <pre><code>System.Net.Mail.SmtpFailedRecipientException was caught HResult=-2146233088 Message=Mailbox unavailable. The server response was: Authentication is required for relay Source=System FailedRecipient=&lt;webuser@domain.com&gt; </code></pre> <p>Looks like it's wanting the user login details for the web address I'm wanting to send to. How can I amend this and send such confirmation emails like how all the other commercial companies do? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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