Emailing info from a Database

Discussion in 'Databases' started by Hidden Farce, Jun 14, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Using CDO mail, I'm having some trouble with the adding an attachment to the email (Server.MapPath). I keep getting the error 'path not found.' Below is a sample of the code. I appreciate any help anyone can offer.

    set objMessage = createobject('cdo.message')
    set objConfig = createobject('cdo.configuration')
    ' Setting the SMTP Server
    Set Flds = objConfig.Fields
    Flds.Item('http://schemas.microsoft.com/cdo/configuration/sendusing') = 2
    Flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver') = 'localhost'
    Flds.update

    Set objMessage.Configuration = objConfig

    if request('subemail') & '' <> '' then
    objMessage.To = request('subemail')
    Else
    objMessage.To = '[email protected]'
    end if

    '----------------------------

    strBody = bodyemail

    objMessage.From = 'giftandhomepreview.com <[email protected]>'
    objMessage.Subject = 'Subscription Requests for ' & daterangetext
    objMessage.AddAttachment(Server.MapPath('e:\web\giftandhome\htdocs\subs.csv'))
    objMessage.TextBody = strBody
    objMessage.fields.update
    objMessage.Send
    Response.write 'Mail sent...'

    set objMessage = nothing
    set objConfig = nothing
     
  2. Try inputing

    objMessage.AddAttachment(Server.MapPath('subs.csv'))

    The server.mappath already points your application to the webroot so server.mappaht is the same as inputting e:\web\giftandhome\htdocs
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page