Hi! I'm trying to get an asp form to attach a file to the email it's sending. So far in all the tutorials i've found, they only show emailing files that are already on the server. I took a form that our district webmaster created and i modified it to fit my needs. But now I need to add a file attachment option that only allows images. What do I add to this form processor?
<%
Dim filesys, appfile
Set filesys = CreateObject("Scripting.FileSystemObject")
Set appfile = filesys.OpenTextFile("c:\Fileshare\nmhsannnounce.htm", 2,true)
appfile.Close
%>
<div class="warning">
Your photo has been sent to the NMHS Webmasters for review!<br />
Check back in a day or two for your photo to be uploaded.
</div>
<%
' Send by connecting to port 25 of the SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim Email
Dim sendTo
Const cdoSendUsingPort = 2
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
sendTo = "109115375963370419749.stallions@picasaweb.com, nmhswebsite@gmail.com"
Set Email = Request.Form("requiredEmail")
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "hidden"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = sendTo
.From = Email
.Subject = ""
.CreateMHTMLBody "file://c:/fileshare/nmhsannnounce.htm"
.Send
End With
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
Question
classicdisastr
Hi! I'm trying to get an asp form to attach a file to the email it's sending. So far in all the tutorials i've found, they only show emailing files that are already on the server. I took a form that our district webmaster created and i modified it to fit my needs. But now I need to add a file attachment option that only allows images. What do I add to this form processor?
<% Dim filesys, appfile Set filesys = CreateObject("Scripting.FileSystemObject") Set appfile = filesys.OpenTextFile("c:\Fileshare\nmhsannnounce.htm", 2,true) appfile.Close %> <div class="warning"> Your photo has been sent to the NMHS Webmasters for review!<br /> Check back in a day or two for your photo to be uploaded. </div> <% ' Send by connecting to port 25 of the SMTP server. Dim iMsg Dim iConf Dim Flds Dim Email Dim sendTo Const cdoSendUsingPort = 2 set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields sendTo = "109115375963370419749.stallions@picasaweb.com, nmhswebsite@gmail.com" Set Email = Request.Form("requiredEmail") ' Set the CDOSYS configuration fields to use port 25 on the SMTP server. With Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "hidden" .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 .Update End With ' Apply the settings to the message. With iMsg Set .Configuration = iConf .To = sendTo .From = Email .Subject = "" .CreateMHTMLBody "file://c:/fileshare/nmhsannnounce.htm" .Send End With ' Clean up variables. Set iMsg = Nothing Set iConf = Nothing Set Flds = Nothing %>Link to comment
Share on other sites
0 answers to this question
Recommended Posts