Associate
Hi All,
I'm trying to figure out how i can submit an email using classic asp to an address and stream the attachment.
So far this is what i have got, it's a medley of 2 scripts, and i am unsure on the streaming part.
Form:
Upload.asp
Help is much appreciated.
Tucks
I'm trying to figure out how i can submit an email using classic asp to an address and stream the attachment.
So far this is what i have got, it's a medley of 2 scripts, and i am unsure on the streaming part.
Form:
Code:
<form action="upload.asp" method="post" enctype="multipart/form-data">
<INPUT TYPE="file" NAME="FileUpload1" id="FileUpload1" MAXLENGTH=50>
<input type="submit" name="Submit" value="Submit" />
</form>
Upload.asp
Code:
<%
If FileUpload1.HasFile Then
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="my.SMTPServer.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="Username"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="Password"
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "[email protected]"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "[email protected]"
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.AddAttachment=Request.Form("FileUpload1")
Const cdoContentDispostion = "urn:schemas:mailheader:content-disposition"
Const cdoBase64 = "base64"
Set oPart = ObjSendMail.Attachments.Add
oPart.ContentMediaType = "application/octet-stream"
oPart.ContentTransferEncoding = cdoBase64
oPart.Fields(cdoContentDisposition).Value = Request.Form("FileUpload1")
oPart.Fields.Update
Set oStreamOut = oPart.GetDecodedContentStream
oStreamOut.Write aByt
oStreamOut.Flush
ObjSendMail.Send
Set ObjSendMail = Nothing
End If
%>
Help is much appreciated.
Tucks