上传文件到服务器,然后附加到电子邮件和发送ASP [英] Upload file to server, then attach to email and send in asp

查看:116
本文介绍了上传文件到服务器,然后附加到电子邮件和发送ASP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

任何帮助真的AP preciated ....

Any help is really appreciated....

推荐答案

我强烈建议你在code这样做,不监视文件夹服务器上的任何变化! EG,上传完成后发送邮件使用CDOSYS邮件

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

我要假设你知道文件名和文件的位置,并且可以存储这个路径作为一个变量。我不知道你选择了,所以我会用一个变量叫什么变量名 uploadedFilePath

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") ="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
%> 

这篇关于上传文件到服务器,然后附加到电子邮件和发送ASP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆