Email settings in web.config

Discussion in 'Visual Studio' started by nmyers, Dec 16, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm having difficulty identifying the correct settings for DASP email. The settings below produce an error. I have tried "localhost" instead of "DiscountASP.net" and still get an error. Can you help me?

    <mailSettings>
    <smtp from="[email protected]">
    <network host="DiscountASP.net" password="******" port="587" userName="[email protected]" />
    </smtp>
    </mailSettings>

    Norm
     
  2. Thanks, I appreciate the help. However, I also need the web.config settings for use in password recovery. Any ideas?
     
  3. Joseph Jun

    Joseph Jun DiscountASP.NET Staff

    The problem that you're having is due to the settings that are being used. Try using the following:

    Code:
    <mailSettings>
    <smtp from="[email protected]">
    <network host="localhost" password="" port="25" userName="" />
    </smtp>
    </mailSettings>
     
  4. I also am having an issue sending email and it was working before during some earlier tests.

    I did try the code you point to, here's my copy with my modifications for my code:

    Dim MailMsg As New MailMessage(New MailAddress(from), New MailAddress(recipient))
    MailMsg.BodyEncoding = Encoding.Default
    MailMsg.Subject = subject
    MailMsg.Body = body
    MailMsg.Priority = MailPriority.High
    MailMsg.IsBodyHtml = False
    'Smtpclient to send the mail message
    Dim SmtpMail As New SmtpClient
    SmtpMail.Host = "localhost"
    SmtpMail.Send(MailMsg)

    I found this code gave an "unable to relay" error, so I added this line before the SmtpMail.Send ... :

    SmtpMail.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis

    The code then executes fine, but I never get the email.

    Any ideas?
     
  5. In case anyone reads this thread and is interested, I figured out the issue.

    I captured the error with the above code - "Error in processing. The server response was: Greylisted, please try again in 900 seconds."

    So I changed the DeliveryMethod from SmtpDeliveryMethod.PickupDirectoryFromIis -to- SmtpDeliveryMethod.Network.

    Now works.
     
  6. mjp

    mjp

    Thanks for posting the follow-up!
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page