Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: attaching files in cdo ntss


Message #1 by "Eric Van Camp" <eric@a...> on Sat, 14 Apr 2001 00:28:07 +0200
This is a multi-part message in MIME format.



------=_NextPart_000_0017_01C0C479.C7638950

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: 7bit



Hi, i want to attache files to my mail which i send fro my mailserver?

It is in fact a confirmation of an order, and it is possible that different

files need to be attached!

i have the following command:

*****code************

<%

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''

''   Atmilestone

''   Functie      : SENDMAIL

''   Parameters   : subject

''         message

''         recipient

''         attachefile

''         method

''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''







Sub SendMail (subject, message, recipient, attachefile, method)



rem prepare the mail

mailfrom = application("emailfrom")

mailreplyaddress = application("adminemail")



if method = "CDONTS" then 'SMTP



 rem create a new mail object

 set objNewMail = createobject("CDONTS.NewMail")



 rem assign sender to mail

 objNewMail.from = storename



 rem send mail to uploader

 objNewMail.to = recipient

 '& "; " & mailfrom



 rem set return address as administrator

 objNewMail.Value("Reply-To") = application("emailfrom")



 rem set mail format

 objNewMail.bodyformat = cdobodyformathtml

 objNewMail.mailformat = cdocdomailformattext



 rem set mail subject

 objNewMail.subject = subject



 rem set mail body

 objNewMail.body = message



 rem attach file if indicated

 if trim(attachfile) <> "" then



  if fs.fileexists(afilename) then

   rem attach copy of denied vfile

   objNewMail.AttachFile afilename

  else

   'response.write "no vfile: "& afilename

  end if

 end if



 rem send the mail

 objNewMail.send



 rem destroy the mail

 set objNewMail = nothing



elseif method = "CDO" then



 rem set exchange server to use for sending mail

 Const cStrServer = "ntseporta"



 rem set the mailbox to log on to

 Const cStrMailbox = "hyperdocs_exchange"



 'insert a line feed

 bstrProfileInfo = cStrServer & vbLf & cStrMailbox



 'create sessionSet

 set objSess = Server.CreateObject("mapi.session")

 objSess.Logon "", "", False, True, 0, True, bstrProfileInfo



 Set objFBMess = objSess.Outbox.Messages.Add



 objFBMess.Subject = subject



 objFBMess.Text = message



 Set objRecips = objFBMess.Recipients' e-mail name to send



 objRecips.Add recipient



 'message to

 objRecips.Resolve

 objFBMess.Send

 objSe

ss.Logoff

end if

End Sub



then i do the following:

sendmail "New order on Ameel-On-Line website", strbody, rsname("email")&

";"& application ("adminemail"), ,"CDONTS"



Met Vriendelijke groet,

Eric Van Camp

Atmilestone BVBA

Trolieberg 74

3010 Kessel-lo

Tel:016/35.69.99

Fax:016/35.57.90

eric@a...











Notice:The information contained in this electronic mail message is

privileged and

confidential, and is intended only for use of the addressee. If you are not

the intended recipient, you are hereby notified that any disclosure,

reproduction, distribution or other use of this communication is strictly

prohibited. If you have received this communication in error, please notify

the sender by reply transmission and delete the message without copying or

disclosing it.











  Return to Index