Problem:
Bytes --------------------------------------------------------------------------------------------------------------------
Microsoft-IIS/5.0
The mail sending component is supported:
Jmail. smtpmail (dimac jmail email sending and receiving) √ 4.4
The Code is as follows:
<%
Set jmail = server. Createobject ("jmail. smtpmail") 'creates a jmail object
Jmail. Silent = true 'jmail does not throw exception errors. The returned values are false and true.
Jmail. Logging = true' enable use Log
Jmail. charset = "gb2312" 'the email text code is simplified Chinese
Jmail. contenttype = "text/html" 'the email format is html
Jmail. serveraddress = "smtp.163.com" 'server for sending emails
Jmail. addrecipient "xxx@163.com" 'email recipient
Jmail. sendername = "sendername" 'name of the email sender
Jmail. Sender = "xxx@163.com" 'email address of the sender
Jmail. Priority = 1' urgent mail program, 1 is the fastest, 5 is the slowest, 3 is the default
Jmail. Subject = "mail subject" 'mail title
Jmail. Body = "mail body" 'mail content
Jmail. Execute () 'execute the mail to send
Jmail. Close 'Close the email object
Response. Write "OK"
%>
Can code be executed successfully, but cannot receive emails? What is the problem?
Bytes ---------------------------------------------------------------------------------------------------------------------
The SMTP server requires authentication. If you are a user of 163, you can add the user name and password to your program for authentication.
The following code is derived from guest7 (guest 7)
///////////////////////////
'================================================ ========================
'Function name: Sendmail
'Use: Use the jmail component to send an email (in the form of verification required)
'Note: The jmail4.3 component re-designs its internal structure-Use
'Message object replaces the original single object jmail. smtpmail for sending
'Email, some methods require authentication (such as 163 and Yahoo ),
'You can use the following method to solve the problem:
'Parameter: mailtoaddress ---- recipient address
'Mailtoname ----- Recipient Name
'Subject ----- topic
'Mailbody ----- mail content
'Fromname ----- sender's name
'Mailfrom ----- sender address
'Mailserver ----- SMTP server address used for sending mail
'Priority ----- mail priority
'Mailserverusername ----- logon Username
'Mailserverpassword ----- logon Password
'Maildomain ----- Domain Name
'================================================ ========================
Function Sendmail (mailtoaddress, mailtoname, subject, mailbody, fromname, mailfrom, MailServer, priority, mailserverusername, mailserverpassword, maildomain)
On Error resume next
Dim jmail
Set jmail = server. Createobject ("jmail. Message ")
If err then
Sendmail = "<br/> <li> the jmail component is not installed </LI>"
Err. Clear
Exit Function
End if
Jmail. charset = "gb2312" 'email code
Jmail. Silent = true
Jmail. contenttype = "text/html" 'mail body format
Jmail. serveraddress = MailServer 'smtp server used to send emails
'If the server requires SMTP authentication, you also need to specify the following parameters
Jmail. mailserverusername = mailserverusername 'logon Username
Jmail. mailserverpassword = mailserverpassword 'logon Password
Jmail. maildomain = maildomain 'domain name (specify domain.com
Jmail. addrecipient mailtoaddress, mailtoname' recipient
Jmail. Subject = subject 'topic
Jmail. hmtlbody = mailbody 'mail body (in HTML format)
Jmail. Body = mailbody 'mail body (in plain text format)
Jmail. fromname = fromname 'sender's name
Jmail. From = mailfrom 'sender email
Jmail. Priority = Priority 'mail level. 1 is urgent, 3 is normal, and 5 is low.
Jmail. Send (MailServer)
Sendmail = jmail. errormessage
Jmail. Close
Set jmail = nothing
End Function
After testing, the above Code can be sent to most free mailboxes, but an error occurs when I send the code to my Yahoo mailbox. The server rejects the email. somehow?