0

我有一个根据用户输入上传文件的应用程序..将图像上传到我的网络服务器上的文件夹。我现在希望脚本在上传后发送附有图片的电子邮件

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

4

1 回答 1

1

我强烈建议您在代码中执行此操作,并且不要监视服务器上的文件夹是否有任何更改!EG,上传完成后使用 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
%> 
于 2013-04-16T09:12:47.220 回答