Sending email from a webpage using ASP

Categories Web HostingScriptingASP.NET

We've installed Dimacs w3JMail Email Object onto our Cloud Hosting Windows server environment for developers to use when sending emails from a webpage. Documentation and example scripts are available on the Dimacs w3JMail product page.

Any other scripts which are being used to send emails via our Windows server environment should use the outgoing email server of ‘localhost’ rather than attempt to connect to a external SMTP server. In ASP.NET, the following should work fine: System.Web.Mail.SmtpMail.SmtpServer = “localhost"

Emails which are not sent to the ‘localhost’ server will fail.

Example code

For customers on our Windows Cloud Hosting environment who want to send email from a webpage, we recommend you use the following code:


 <html> <body>


 DIM strEmail, strFirstName, strLastName, strSubject, strComments, Mailer

         strEmail = Request.Form("Email")         
         strFirstName = Request.Form("FirstName")         
         strLastName = Request.Form("LastName")         
         strSubject = Request.Form("Subject")         
         strComments = Request.Form("Comments")

 set msg = Server.CreateOBject( "JMail.Message" )

         msg.From = strEmail         
         msg.FromName = strFirstName
         msg.AddRecipient "" 
         msg.Subject = strSubject         
         msg.Body = Comments

  if not msg.Send("localhost" ) 

      Response.write "<pre>"& msg.log & "</pre>"


      Response.write "Message sent succesfully!"

   end if


Rate this article
Get more leads