Getting Error Transport error code was 0x80040217 while Sending Email in Asp.Net

后端 未结 4 1005
孤独总比滥情好
孤独总比滥情好 2020-12-06 16:20

I am trying to send Email

But I am getting this Error.

The message could not be sent to the SMTP server. The transport error code was 0x80040217. Th

相关标签:
4条回答
  • 2020-12-06 16:35

    It's caused by a wrong username or password for the SMTP server and usually means that the server has disabled your account for spamming i you've sent 1500 mails

    0 讨论(0)
  • 2020-12-06 16:39

    Thanks for your replies, it worked! it was because I didn't have this option enabled: https://www.google.com/settings/security/lesssecureapps In case somebody needs it, this is the VBScript code I'm using in Qlikview:

    SUB SendMail
        Dim objEmail
    
        Const cdoSendUsingPort = 2  ' Send the message using SMTP
        Const cdoBasicAuth = 1      ' Clear-text authentication
        Const cdoTimeout = 60       ' Timeout for SMTP in seconds
    
         mailServer = "smtp.gmail.com"
         SMTPport = 465     '25 'SMTPport = 465
         mailusername = "marcos.esgu**@gmail.com"
         mailpassword = "Ki***"
    
         mailto = "marcos.esgu**@*****" 
         mailSubject = "my test-deleteme" 
         mailBody = "This is the email body" 
    
        Set objEmail = CreateObject("CDO.Message")
        Set objConf = objEmail.Configuration
        Set objFlds = objConf.Fields
    
        With objFlds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailServer
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPport
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = cdoTimeout
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasicAuth
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = mailusername
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mailpassword
            .Update
        End With
    
        objEmail.To = mailto
        objEmail.From = mailusername
        objEmail.Subject = mailSubject
        objEmail.TextBody = mailBody
        'objEmail.AddAttachment "C:\report.pdf"
        objEmail.Send
    
        Set objFlds = Nothing
        Set objConf = Nothing
        Set objEmail = Nothing
    END SUB
    
    0 讨论(0)
  • 2020-12-06 16:41

    Discovered that you can also get this error when Gmail's security settings don't allow messages to be sent from the address you intend to use. I had to enable access for less secure apps for my account in question by:

    1. Logging into the address you want to use for sending email from Excel.
    2. Visit the page https://www.google.com/settings/security/lesssecureapps
    3. Click Enable Less Secure Apps.
    4. Click Done.
    0 讨论(0)
  • 2020-12-06 16:42

    Had the same problem using BizTalk, where adapter default handler specified to use NTLM authentication (by default). Even though I specified to override handler on send port properties, BizTalk did not allow me to override adapter default handler. I needed to change adapter default handler in order to get it to work.

    Now it works!

    0 讨论(0)
提交回复
热议问题