简体   繁体   English

从经典ASP发送电子邮件

[英]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). 问题是电子邮件只发送大约5-10条记录(一旦发送5封电子邮件,cc和所有内容,第二天发送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. 编辑:在更多的调试,事实证明,当我将objMail.To替换为发送给每个学生的电子邮件到我自己的电子邮件。 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. 时间,可以跟踪这个电子邮件地址问题或其他问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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