ASP 中VBScript发送邮件

本文介绍了一个使用HTML和VBScript实现的邮件确认流程,该流程通过表单收集用户信息,并利用SMTP发送带有特定链接的确认邮件。文章详细展示了如何设置邮件内容、收件人以及邮件正文。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<html>
<head>
   <LINK href="mystyle.css" type="text/css" rel="stylesheet">
</head>
<body>
<p class="largeHeader">Email Confirmation</p>
<hr class="topHr">
<%

  YourName = Request.Form("YourName")
  FriendName = Request.Form("FriendName")
  EMailAddress = Request.Form("FriendEmail")
  myURL = Request.Form("myURL")
  Comments = Request.Form("Comments")

  On Error Resume Next
  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  If Err > 0 Then
  Response.Clear
  Response.Redirect Application("Server") & "/Err.asp"
  End If

  Mailer.FromName = application("FromName")
  Mailer.FromAddress = application("FromAddress")
  Mailer.RemoteHost = application("SMTP")
  Mailer.AddRecipient FriendName, EMailAddress

  Mailer.Subject = YourName & " has found an opportunity for you!"
  Mailer.ContentType = "Text/HTML"

  myBody = "<HTML>"
  myBody = myBody & "<body>"
  myBody = myBody & "<table>"
  myBody = myBody & "<tr><td><font face='verdana' size='2'>"
  myBody = myBody & "Dear <font color='darkblue'>" & FriendName
  myBody = myBody & "</font></td></tr>"
  myBody = myBody & "<tr><td>&nbsp;</td></tr>"
  myBody = myBody & "<tr><td><font face='verdana' size='2'>Your friend <font color='darkblue'>" & YourName & "</font> has found an opportunity for you.</td></tr>"
  myBody = myBody & "<tr><td colspan='2'><font face='verdana' size='2'><b><a href=" & myURL & ">Click here</a> to see the opportunity.</b></td></tr>"
  myBody = myBody & "<tr><td colspan='2'>&nbsp;</td></tr><tr>"
  If (Comments <> "") Then
     myBody = myBody & "<tr><td colspan='2'><font face='verdana' size='2'>Additional Comments:</font></td></tr>"
     myBody = myBody & "<tr><td colspan='2'><font face='verdana' size='2'>" & Comments & "</font></td></tr>"
  End If

  myBody = myBody & "</table></body></html>"

  Mailer.BodyText = myBody

  If Mailer.SendMail Then
     Response.Write "<font class='bodyText'>You have successfully sent this job description.</font>"
  Else
     Response.Write "<font class='errorMessage'>Please check the e-mail address that you have typed - unable to send to this address.</font>"
  End If

  'If you are receiving errors use Mailer.Reponse to view the error code
  'Most common problem is an SMTP setting error.
%>
</body>
</html> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值