简体   繁体   English

寄往和寄出邮件以存储在数据库中

[英]CDONTS TO and From mail to be stored in DB

I have an old application which sends mail using CDONTS in classic ASP. 我有一个旧的应用程序,它使用经典ASP中的CDONTS发送邮件。

Now, I wanted to store the to and from addresses of every mail sent in a database. 现在,我想保存tofrom数据库中发送的每个邮件地址。

Dim a="' & 'FirstName LastName'<emailaddress>'"
trixMail.From= a
Dim b =  "anotheremailaddress"
trixMail.To = b 

a =TrixMail.From

b= TrixMail.To
Dim MM_query  
Dim MM_editCmd
MM_query =  "Insert into Logmail(FromEmail,ToEmail) values('"+a+"', '"+b+"')"

Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_dbConn_STRING
MM_editCmd.CommandText = MM_query
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

So, this is what I'm doing. 所以,这就是我正在做的。 However , i get an error saying 但是,我得到一个错误的说法

Expected end of statement at the line i declare variable 'a'. 我在声明变量'a'的那一行预期的语句结尾。

So, can u let me know where I'm going wrong? 所以,你能让我知道我要去哪里了吗?

This line is the problem: 这行是问题所在:

Dim a="' & 'FirstName LastName'<emailaddress>'"

Change to 改成

Dim a: = """FirstName LastName"" <emailaddress>"

or 要么

Dim a
a = """FirstName LastName"" <emailaddress>"

I have removed the name and e-mail address you posted, replace as needed. 我已经删除了您发布的名称和电子邮件地址,请根据需要替换。

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

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