This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?

Web Development Code Library ASPSend Mail using JMail

Send Mail using JMail

Example showing how to send mail using our servers and W3 JMail

<%

Dim strErrorMessage
Dim objJMail

     Set objJMail = server.CreateObject("jmail.smtpmail")
     
     With objJMail       'With Object blocks are faster and easier to type
     
          ' Properties are assigned values using the = sign.
          
          .ServerAddress = "smtp2.uwec.edu"    ' Server address
          .ServerPort = 25                    ' optional, default is 25  
          .SenderName = "WEB"                 ' The name that appears in the mail program
          .Sender = "homer@uwec.edu"        ' The from address
          
          ' These are methods, and therefore do not get assigned values
          ' Instead, values are passed.
          
          .AddRecipient "bart@uwec.edu"     ' First recipient
          .AddRecipient "lisa@uwec.edu"     ' Seconde recipient
          .AddRecipientCC "maggie@uwec.edu"   ' CC recipient
          .AddRecipientBCC "cmburns@uwec.edu"  ' BCC recipient
          
          ' These are more properties, and so we assign values again
     
          .Subject = "Form Posted from Web"
          .Body = "This is the text for my message. Hello there"
          
          .Priority = 1                 ' 1 is high, 3 is medium, 5 is lowest
          
          .ContentType = "text/html"    ' You can also use .ContentType = "text/plain"
         
          .Execute                          ' This sends the message

          strErrorMessage = .ErrorMessage
     
     End With

     ' Cleaning up, just like a db connection

     objJMail.Close
      Set objJMail = nothing

%>
Excellence. Our Measure. Our Motto. Our Goal.