Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Attachment in Email System (CDONTS)

    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

  • #2
    Regular Coder
    Join Date
    Dec 2007
    Posts
    107
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Smile

    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
    Programming & Webmaster Forum - AdSense Revenue Sharing forum

  • #3
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>"

  • #4
    New Coder
    Join Date
    Dec 2007
    Location
    UK
    Posts
    41
    Thanks
    1
    Thanked 7 Times in 7 Posts
    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!

  • #5
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    I think CDONTS is a bit outdated now.

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

    Cheers

    Steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •