Jan 31 2006

OCXMail

Posted by admin under Generic sendmail

Function SendEmail( sEmailServer, sFromEmail, sToEmail, sSubject, sText )
   Dim objMail
   set objMail = Server.CreateObject("ASPMail.ASPMailCtrl.1")
   SendEmail =  objMail.SendMail(sEmailServer, sToEmail, sFromEmail, sSubject, sText)
   Set objMail = nothing
End Function
 
1. Copy it into a file called incgenmail.asp

2. Include that file from your ASP page supposed to send the mail
<!--#include file="incgenmail.asp"-->


3. Call it like this:
sErrMsg = SendEmail( "smtp.theserver.com",  
           "webmaster@aspcode.net", 
           "John@doe.com", 
           "Important message", 
           "This is an important message bla bla" ) 


4. You can check sErrMsg. If it is "" then mail was sent ok, otherwise there was an error and sErrMsg contains an descriptive text of it.

Links