Email Attachments using CDONTS

Results 1 to 6 of 6

Thread: Email Attachments using CDONTS

  1. #1
    Kim( Guest

    Default Email Attachments using CDONTS

    I am trying to send an email with an attachment, and I am having no luck. I am passing the document path in a query string, FaxDocName=pdfir5000.pdf. I then do the following:<BR><BR>sDocument=request.querystring("F axDocName")<BR><BR>Dim objCDO<BR> Set objCDO = Server.CreateObject("CDONTS.NewMail")<BR> objCDO.To = sEmail<BR> objCDO.From = sFrom<BR> objCDO.Subject = sTitle<BR> objCDO.Body = sBody<BR> objCDO.AttachFile = sDocument<BR> <BR> objCDO.Send<BR> <BR> Set objCDO = Nothing<BR> Response.Redirect "Success.asp"<BR><BR>Any help I would appreciate

  2. #2
    Join Date
    Dec 1969

    Default RE: Email Attachments using CDONTS

    If you wish to include an attachment with your mail message, use the AttachFile method of the NewMail object (which you have). This method has three parameters. <BR><BR>The first parameter is Source, of type String or Istream object. This parameter is required, and must contain the full path and file name of the attachment. Only C/C++ and Java programs can use an Istream object. <BR><BR>The second (optional) parameter is FileName, of type String. This provides a file name to appear in the attachment&#039;s placeholder in the message. If not specified, the file name from the Source parameter is used. <BR><BR>The third (optional) parameter is EncodingMethod, of type Long, which indicates the encoding of the attachment. There are two possible values: 0, meaning the attachment is in UUEncode format; and 1, indicating the attachment is in Base64 format. (Base64 is the encoding scheme defined by MIME; UUEncode is an older format that you should use if you suspect your recipient(s) may not have a MIME-compliant system.) The default value of this parameter depends upon the MailFormat property. If the MailFormat property is set to 1, the default value of EncodingMethod is 0. If the MailFormat property is set to 0, the default value of EncodingMethod is 1. <BR><BR>In the example below, the MailFormat property to 0, but still explicitly assign a value of 1 to the EncodingMethod parameter, for demonstration purposes.<BR><BR>&#060;%<BR>Dim MyMail<BR>Set MyMail = Server.CreateObject("CDONTS.NewMail")<BR>MyMail.Fr om = ""<BR>MyMail.To = ";"<BR>MyM ail.Cc = ";"<BR>MyM ail.Bcc = ";"<BR>MyM ail.Subject = "sending email via CDONTS NewMail"<BR>MyMail.BodyFormat = 1<BR>MyMail.MailFormat = 0<BR>MyMail.Importance = 2<BR>MyMail.Body = "Sending email with CDONTS NewMail" &_<BR> "objects is easy! Try it!"<BR>MyMail.Attachfile "c:pathsmiley.gif", "smilefile.gif", 1<BR>%&#062; <BR><BR>Regards,<BR>Rob

  3. #3
    JG Guest

    Default RE: Email Attachments using CDONTS

    objCDO.AttachFile is expecting the physical path:<BR><BR>c:lahlahlahfilename.pdf<BR><BR>Che ck out Server.MapPath()

  4. #4
    Kim( Guest

    Default RE: Email Attachments using CDONTS

    I tried that and I get the following error<BR><BR>Microsoft VBScript runtime error &#039;800a01b6&#039; <BR>Object doesn&#039;t support this property or method: &#039;AttachFile&#039; <BR>/tenant/faxSend.asp, line 50 <BR><BR>my code is as follows:<BR>objCDO.AttachFile = (sDocument)<BR>where sDocument = "D:inetpubwwwroot enantpdfir5000.pdf"

  5. #5
    JG Guest

    Default RE: Email Attachments using CDONTS

    remove the &#039;=&#039;<BR><BR>objCDO.AttachFile(sDocumen t)

  6. #6
    Kim( Guest

    Default You are the best - it worked

    Thanks for your help, I owe you.

Posting Permissions

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