上传文件到服务器,然后附加到电子邮件和发送ASP(Upload file to server, th

2019-08-31 07:54发布

我有,根据用户输入上传文件的应用程序..这上传图片到一个文件夹我的Web服务器上。 我现在想的脚本发送附有图像的电子邮件它的上传后,

任何帮助,非常感谢....

Answer 1:

我强烈建议你在代码中做到这一点,不监视你的服务器进行任何更改的文件夹! 例如,上传完成后发送邮件使用CDOSYS邮件

我会假设你知道文件名和文件的位置,并且可以存储这个路径作为一个变量。 我不知道是什么变量名,你选择了,所以我会用一个变量叫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") ="myEmail@myDomainName.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="myPassword"

ObjSendMail.Configuration.Fields.Update

ObjSendMail.To = "someone@AntoherDomain.com"
ObjSendMail.Subject = "Upload complete"
ObjSendMail.From = "me@myDomainName.com"
ObjSendMail.AddAttachment = uploadedFilePath

ObjSendMail.HTMLBody = "<p>Hi,<br /> A file has been uploaded!</p>"    
ObjSendMail.Send    
Set ObjSendMail = Nothing
%> 


文章来源: Upload file to server, then attach to email and send in asp
标签: asp-classic