Reputation: 359
I am having a application that uploads files according to the user input.. that upload an image to a folder on my web server. I now want the script to send an email with the image attached after it's uploaded
Any help is really appreciated....
Upvotes: 0
Views: 1763
Reputation: 8461
I strongly suggest you do this in the code and don't monitor the folder on your server for any changes! EG, after the upload is complete send the email using CDOSYS
I am going to assume you know the file name and file location and can store this path as a variable. I don't know what variable name you chose so I will use a variable called uploadedFilePath
<%
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yourDomainName.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
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="myPassword"
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "[email protected]"
ObjSendMail.Subject = "Upload complete"
ObjSendMail.From = "[email protected]"
ObjSendMail.AddAttachment = uploadedFilePath
ObjSendMail.HTMLBody = "<p>Hi,<br /> A file has been uploaded!</p>"
ObjSendMail.Send
Set ObjSendMail = Nothing
%>
Upvotes: 1