Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail attachment 1

Status
Not open for further replies.

glenmac

Technical User
Jul 3, 2002
947
CA
Hi I borowed this code from a post here. I'd like to add an attachment to the emails sent, Does anyone know if this is possible and if so what the syntax is?
Code:
Dim Users(2)
Users(0) = "Fred@test.com"
Users(1) = "Bob@test.com"
Users(2) = "Pete@test.com"

For i = 0 to 2
  Set objOutlk = createobject("Outlook.Application")
  Set objMail = objOutlk.createitem(0)
  objMail.To = Users(i)
  objMail.subject = MailSubject
  objMail.body = MailBody
  objMail.send
Next

 
looks like you're using CDONTS so try this:
<%
mail.AttachFile server.MapPath(&quot;attachedfile.asp&quot;) 'You must use the exact server path.
%>
&quot;Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!&quot;
Marvin the Martian
 
No I'm not using CDONTS. I'm calling Outlook.
&quot;&quot;Set objOutlk = createobject(&quot;Outlook.Application&quot;)&quot;&quot;
I've tried .Attachfile and it gives me &quot;object doesn't support this property or method objMail.attachFile&quot;
 
OOPS! Sorry 'bout that, try this:


'To add an attachment, use:
'objMail.attachments.add(&quot;C:\MyAttachmentFile.txt&quot;)
objMail.body = strMsg
objMail.display 'Use this To display before sending, otherwise call objMail.Send to send without reviewing &quot;Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!&quot;
Marvin the Martian
 
Thanks hithere worked great!! Star for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top