...

View Full Version : Attachment in Email System (CDONTS)



zami
12-15-2007, 08: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
thanks

technica
12-16-2007, 11: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
objMail.Send
set objMail = nothing

Try this code. Remember to change the variables appropriatly

zami
12-17-2007, 07: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=" & _
Server.MapPath("mail.mdb")

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

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

tonyyeb
12-18-2007, 08: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!

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

http://www.paulsadowski.com/WSH/cdo.htm

Cheers

Steve



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum