View Full Version : Attachment in Email System (CDONTS)

12-15-2007, 07:30 AM
I make a mailing page to send mails to my newsletter system but i need to attach a file or document of any type with this mail can someone help me in this regard

12-16-2007, 10:13 AM
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.Body = bMore
objMail.Subject = sText
objMail.From = fname
objMail.To = tName
objMail.AttachFile aFile
objMail.Importance = 2
set objMail = nothing

Try this code. Remember to change the variables appropriatly

12-17-2007, 06:30 AM
I already tried this, but it saying error '80004005'

/admin_ac.asp, line 27
Dim rs, mail, subject, message, data_source, sql_select, no

no = 0
subject = Request.Form("subject")
message = Request.Form("message")
attach1 = Request.Form("attach1")

message = message & vbcrlf & vbcrlf & "To stop receiving emails click here :"
message = message & vbcrlf & "http://www.abc.comk/del.asp?email="
sql_select = "select email from users"
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _

If Len(message) Then

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql_select, data_source
While Not rs.EOF
Set Mail = Server.CreateObject("CDONTS.NewMail")

mail.From = "webmaster@abc.comk"
mail.To = rs("email")
mail.Subject = subject
mail.Body = message & rs("email")
mail.AttachFile attach1

Set mail = Nothing
Response.Write "Email sent to : " & rs("email") & "<br>"

12-18-2007, 07:08 PM
Where is the file you want to attach? Is it on the machine which is browsing the website? If so this maybe your problem. The file needs to be on the server. You need to upload the file first, then attach it to the e-mail.

Hope this helps!

12-21-2007, 02:59 PM
I think CDONTS is a bit outdated now.




EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum