简体   繁体   中英

Sending email from classic ASP

SOLVED: Two students gave us the wrong emails, and for some reason the script refused to process more if it encountered a wrong email. I am still wondering why is it so !

I am trying to read a bunch of records from a database, and for each record I am creating some text based on some fields of the record and then sending them as email to the email address provided in the record. The problem is the email gets sent for only about 5-10 records (it varies, once it sent 5 emails, with cc and everything, next day it sent 7). After this it comes up with the famous error:

error '8004020f'
/sendEmail.asp, line 139

I have researched all around the internet, and I see many have issues with this error, but not the kind that I am having, in which few emails are send and then it stops. Also, all emails are being sent to the same domain, the official school email of the students.

Any ideas? Any settings that I might want to ask the website hosting guy to change?

Here is the code.



    Dim objMail
    Set objMail = CreateObject("CDO.Message")
    objMail.From= "someEmail"
    objMail.To=rstemp("Email")
    objMail.Cc = "someEmail"

    objMail.Subject = subjecttext
    objMail.HTMLBody=tempData

    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2
    'Name or IP of remote SMTP server

    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.*"
    'Server port

    objMail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25

    objMail.Configuration.Fields.Update

    objMail.Send

    set objMail=nothing
    tempData = nothing

EDIT: On more debugging, it turns out that when I replace the objMail.To from sending it to each student's email to my own email. It works fine and sends all the emails to me.

Please check first all the Emails is valid and no test email is there. and you can test it with send all emails on same email address for no. of time and can track the problem that is this Email address problem or something else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM