程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程問題解答 >> 如何用組件實現自動發送電子郵件?

如何用組件實現自動發送電子郵件?

編輯:編程問題解答

如何用組件實現自動發送電子郵件?

JMailUploadAutoForm.asp
<html>
<body>
<font face="verdana, arial" size="2"><b>
<form method="post" action="JmailUploadAutoFormProcess.asp" ENCTYPE="multipart/form-data">
<p>撼雪噴雲之動發送電子郵件</p>

請填寫好表單,點擊發送!

<br><br>
您的姓名<br>
<input type="text" size="25" name="name"><br>
電子郵件地址<br>
<input type="text" size="25" name="email"><br>
接收郵件地址<br>
<input type="text" size="25" name="recipient"><br>

您想...<br>
<select name="subject" size="1">
<option value="help">咨詢
<option value="hello">問候
<option value="other">其它
</select>
<br>
主題<br>
<input type="text" size="25" name="tipic"><br>
概述<br>
<input type="text" size="25" name="resume"><br>

請輸入您的內容<br>
<textarea name="question" cols="40" rows="15" wrap="PHYSICAL"></textarea>
<br>
<br>
<br>

附件1<br>
<input type="file" name="attachment1">
<br>
<br>
附件2<br>
<input type="file" name="attachment2">
<br>
<br>
附件3<br>
<input type="file" name="attachment3">
<br>
<br>
<input type="submit" value="發送">
</form>
</b>感謝光臨隨風起舞!
</font>
</body></html>

JmailUploadAutoFormProcess.asp
<%
Set upload = Server.CreateObject( "w3.Upload" )
Set JMail = Server.CreateObject("JMail.SMTPMail")

for i = 0 to upload.form.count-1
if upload.form( i ).isFile then
set attachment = upload.Form( i )
JMail.AddCustomAttachment attachment.filename, attachment.item

' 檢查附件並加入郵件.所有其他的form元素被加到郵件裡.
else
JMail.appendtext( upload.form( i ).name & ": " & upload.form( i ).item & vbcrlf )
end if
next

Name = upload.Form("name")
SenderEmail = upload.Form("email")
Subject = "Regarding " & upload.Form("subject")
Recipient = upload.Form("recipient")

' 得到form變量,用上傳組件.

JMail.ServerAddress = "mail.intels.net"
' 輸入你的SMTP-server.

JMail.Sender = Senderemail
JMail.Subject = Subject
JMail.AddRecipient Recipient
JMail.Priority = 3

JMail.Execute

%>
<html>
<body>
<BR>
<BR>
<p align="center"><font face="Arial, geneva" size="5">
郵件發送成功!</font></p>
<center>
<font face="Arial, geneva" size="3">
您的郵件已發送至<%= Recipient %><br>
<BR>
</font>
</center>
</body></html>

 

 

 

[1]

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved