asp中使用jmail实现发送邮件功能:
function sendMail() on error resume next Set myMail = CreateObject("JMAIL.Message") myMail.Subject = "邮件主题" myMail.From = "发件人邮箱地址" myMail.MailServerUserName = "发件人邮箱账户" myMail.MailServerPassword = "发件人邮箱密码" myMail.AddRecipient "收件人邮箱地址" myMail.Body = "邮件内容" myMail.Send("邮箱服务器") myMail.Close() set myMail = nothing if err.number <> 0 then response.write("error") else response.write("ok") end if end function
说明:
邮箱服务器:比如说如果发件人用的163的邮箱,那登录发件人的邮箱,点击“设置”,找到“POP3/SMTP/IMAP”,
小提示下面就有服务器地址:
POP3服务器:pop.163.com | SMTP服务器:smtp.163.com | IMAP服务器:imap.163.com
下面举个例子:发件人用的163的邮箱
function sendMail(subject, body, email) on error resume next Set myMail = CreateObject("JMAIL.Message") myMail.Subject = subject myMail.From = "lc448986375@163.com" myMail.MailServerUserName = "lc448986375@163.com" myMail.MailServerPassword = "*****" myMail.AddRecipient email myMail.Body = body myMail.Send("smtp.163.com") myMail.Close() set myMail = nothing if err.number <> 0 then 'response.write("error") flag = "false" else 'response.write("ok") flag = "true" end if sendMail = flag end function