With AspEmail, sending a message is only a few lines of code away: Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "smtp.smtp-server.com" ' Specify a valid SMTP server Mail.From = "sales@veryhotcakes.com" ' Specify sender's address Mail.FromName = "VeryHotCakes Sales" ' Specify sender's name Mail.AddAddress "andy@andrewscompany.net", "Andrew Johnson, Jr." Mail.AddAddress "paul@paulscompany.com" ' Name is optional Mail.AddReplyTo "info@veryhotcakes.com"
Mail.Subject = "Thanks for ordering our hot cakes!" Mail.Body = "Dear Sir:" & Chr(13) & Chr(10) & _ "Thank you for your business." On Error Resume Next Mail.Send If Err <> 0 Then Response.Write "Error encountered: " & Err.Description End If
| AspEmail 5.0.1 ManualBenutzung von AspEmail mit EmailAgent Um über die Meldungs-Queue zu versenden muss nur Mail.Queue = true eingefügt werden. Beispiel unten in rot.
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp.mycompany.com" Mail.From = "sales@mycompany.com" Mail.FromName = "Sales Department" Mail.AddAddress "jsmith@company1.com", "John Smith" Mail.Subject = "Sales Receipt" Mail.Body = "Dear John:" & chr(13) & chr(10) & "Thank you for your business." On Error Resume Next Mail.Queue = true Mail.Send If Err <> 0 Then Response.Write "An error occurred: " & Err.Description End If
|
When the SendToQueue method is called, a message is not sent directly to the SMTP server for delivery. Instead, it is packaged into a file and sent to the message queue from where it will be send out about 10 seconds later. Though even if the SMTP mailserver is not up you will not loose any messages as they will be send as soon as the SMTP mailserver is up again.
|