开发者

CDONTS TO and From mail to be stored in DB

开发者 https://www.devze.com 2023-04-01 03:48 出处:网络
I have an old application which sends mail using CDONTS in classic ASP. Now, I wanted to store the to and from addresses of every mail sent in a database.

I have an old application which sends mail using CDONTS in classic ASP.

Now, I wanted to store the to and from addresses of every mail sent in a database.

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

a =TrixMail.From

b= Tri开发者_开发百科xMail.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'.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号