<% Set pop3 = Server.CreateObject( "JMail.POP3" ) 'pop3的连接用户名,密码,pop3地址 pop3.Connect "username", "password", "mail.mydomain.com" Response.Write( "你有" & pop3.count & " 封邮件。
" ) if pop3.count > 0 then Set msg = pop3.Messages.item(1) ReTo = "" ReCC = "" Set Recipients = msg.Recipients separator = ", " ' 现在得到所有的收件人,并且存储 For i = 0 To Recipients.Count - 1 If i = Recipients.Count - 1 Then separator = "" End If Set re = Recipients.item(i) If re.ReType = 0 Then ReTo = ReTo & re.Name & " (" & re.EMail & ")" & separator else ReCC = ReTo & re.Name & " (" & re.EMail & ")" & separator End If Next '这个程序得到附件,并且保存到服务器的硬盘上。也可以返回附件的详细连接 Function getAttachments() Set Attachments = msg.Attachments separator = ", " For i = 0 To Attachments.Count - 1 If i = Attachments.Count - 1 Then separator = "" End If Set at = Attachments(i) at.SaveToFile( "c:\EMail\attachments\" & at.Filename ) getAttachments = getAttachments & "" &_ at.FileName & "(" & at.Size & " bytes)" & "" & separator Next End Function %>
邮件标题 |
<%= msg.Subject %> |
发件人 |
<%= msg.FromName %> |
收件人 |
<%= ReTO %> |
抄送 |
<%= ReCC %> |
附件 |
<%= getAttachments %> |
内容 |
<%= msg.Body %> |
<% end if pop3.Disconnect %> <%@ Language=VBScript %>
<% Dim JMail
t=Request("Body1") t1=Request("Body2") Set JMail=server.createobject("JMail.Message")
JMail.silent = true JMail.Logging = true JMail.Charset = "gb2312" JMail.MailServerUserName = "liuixao" '输入smtp服务器验证登陆名 (邮局中任何一个用户的Email地址) -----改 JMail.MailServerPassword = "649" '输入smtp服务器验证密码 (用户Email帐号对应的密码) -----改 JMail.From = Request.Form("email") '发件人Email JMail.FromName = Request.Form("name") '发件人姓名 JMail.AddRecipient "liu@.sina.net" '收件人Email,多个收件人,就重复多行 -----改 'JMail.AddRecipient "info@cnkl.net" '第二个收信地址----改成7个地址
JMail.Subject = Request.Form("subject") '信件主题 JMail.Body ="内容1:" &t& vbcrlf & "内容2:"&t1 '换行符 & vbcrlf & JMail.Send ("你的邮件服务器地址") 'smtp服务器地址(mail.您的域名)-----改 JMail.Priority=2 JMail.Close() set JMail = nothing %>
邮件发送成功,谢谢使用!
|