Sending attachments via an automated email

text zoom

For sending email attachments via ASP it is possible to use an interface called Collaborative Data Objects for NT Server or (CDO for NTS). Messages are sent out using the SMTP server.


The code below shows an example of sending out an email with attachment.


 


 










<%
Dim CR
Dim MailText
Dim oCDONTSMail
CR = Chr(10) & Chr(13)


Set oCDONTSMail = CreateObject("CDONTS.NewMail")



oCDONTSMail.From= "emailer@myapp.com"
oCDONTSMail.To= session("mailto")
oCDONTSMail.Cc= "info@visualbuilder.com,webmaster@visualbuilder.com "
oCDONTSMail.Subject="automated email"


'this line below is for sending the email attachment


oCDONTSMail.AttachFile "C:\InetPub\wwwroot\myapp\files\" & session("filename")



MailText = "This is an automated email from myapp " & CR
MailText = MailText & "More text " & CR
MailText = MailText & " And more text "



oCDONTSMail.Body= MailText
oCDONTSMail.Send



set oCDONTSMail=nothing
%>


 




                    

Copyright © 2010 VisualBuilder. All rights reserved