none
Problem sending email ASP.NET 3.5 RRS feed

  • 问题

  • Hi
    I am trying to send email through my asp.net 3.5 application (vb.net).
    This is the code I have:

    Dim email As New System.Net.Mail.MailMessage(someone@gmail.com", "someone@gmail.com", "subject", Server.GetLastError.ToString)
            Dim smtp As New SmtpClient()
            smtp.Send(email)
            email.Dispose()
    
    and I have added the following to the web.config file:
    <system.net>
        <mailSettings>
          <smtp deliveryMethod="Network"  >
            <network host="127.0.0.1" port="25" />
          </smtp>
        </mailSettings>
      </system.net>

    However, the email never reaches my gmail account. It just sits in the Queue folder in mailroot, permanantly. The event log has the following entry:
    Event Type: Warning
    Event Source: smtpsvc
    Event Category: None
    Event ID: 4000
    Date:  4/16/2009
    Time:  4:27:52 PM
    User:  N/A
    Computer: MO-LAPTOP
    Description:
    Message delivery to the remote domain 'gmail.com' failed for the following reason: Unable to deliver the message because the destination address was misconfigured as a mail loop.


    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    Data:
    0000: cf 02 04 c0               Ï..À   

    I have Windows XP Pro, Service Pack3. I also tried my yahoo email account (both for the sender of email as well as reciever) and the mails still don't go through.
    I would appreciate any help.
    Many thanks

    2009年4月16日 12:17

答案