Brinkster Knowledge Base

KB Home   /  Support  /  Code Snippets  /  Email  /   How do I send an email with ASP
How do I send an email with ASP Articles
The samples below show how to send email from a Brinkster hosted web site through the supported email components.

Special Note
Be sure to make the following changes when using these coding examples:
1. Replace you@domain.com with a valid Brinkster hosted email account.
2. Replace password with the password for the email account used above.
3. Replace user@domain.com with a valid email account.

**Your FROM address must be the same as the email address you authenticate with.** 



ASPEMail:

<%

Set objEmail = Server.CreateObject("Persits.MailSender")

 

objEmail.Username = "you@domain.com"

objEmail.Password = "password"

objEmail.Host = "mymail.brinkster.com"

objEmail.From = "you@domain.com"

objEmail.AddAddress "user@domain.com"

objEmail.Subject = "Test message sent using the ASPEMail component"

objEmail.Body = "This is a test message."

objEmail.Send

 

Set objEmail = Nothing

%>



CDOSYS:

<%

Dim objEmail

Set objEmail = CreateObject("CDO.Message")

 

objEmail.From = "you@domain.com"

objEmail.ReplyTo = "you@domain.com"

objEmail.To = "user@domain.com"

objEmail.Subject = "Test message sent using the CDOSYS component"

objEmail.TextBody  = "This is a test message."

With objEmail.Configuration.Fields

            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mymail.brinkster.com"

            .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "you@domain.com"

            .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

             .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

            .Update

End With

objEmail.Send

 

Set objEmail = Nothing

%>


IPWorks Mail:

<%

Dim objEmail

Set objEmail = Server.CreateObject("IPWorksASP.Smtp")

 

objEmail.User = "you@domain.com"

objEmail.Password = "password"

objEmail.MailServer = "mymail.brinkster.com"

objEmail.From = "you@domain.com"

objEmail.SendTo = "user@domain.com"

objEmail.Subject = "Test message sent using the IPWorks component"

objEmail.MessageText = "This is a test message."

objEmail.MailPort = 25

objEmail.Send()

 

Set objEmail = Nothing

%>



JMail:

<%

Dim objEmail

Set objEmail = Server.CreateOBject( "JMail.Message" )

objEmail.MailServerUserName = "you@domain.com"

objEmail.MailServerPassword = "password"

objEmail.From = "you@domain.com"

objEmail.ReplyTo = "you@domain.com"

objEmail.AddRecipient "user@domain.com"

objEmail.Subject = "Test message sent using the Jmail component"

objEmail.Body = "This is a test message."

objEmail.Send("mymail.brinkster.com")

 

Set objEmail = Nothing

%>



Below is a mail sample that includes a form. Simply copy and paste this into an ASP page, and make the appropriate edits to the mail server, email address, and password.

<%

posted = request.form ("submit")

if posted = "Submit" then

 

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'' Customize the following 5 lines with your own information. ''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

vtoaddress = "Email@Domain.com" ' Change this to the email address you will be receiving your notices.

vmailhost = "mymail.brinkster.com"  ' Change this to mail.yourDomain or leave as is.

vfromaddress = "You@Yourdomain.com" ' Change this to the email address you will use to send and authenticate with.

vfrompwd = "password" ' Change this to the above email addresses password.

vsubject = "ASP Contact Form" 'Change this to your own email message subject.

 

'''''''''''''''''''''''''''''''''''''''''''

'' DO NOT CHANGE ANYTHING PAST THIS LINE ''

'''''''''''''''''''''''''''''''''''''''''''

vfromname = request.form ("TName")

vbody = request.form ("TBody")

vrplyto = request.form ("TEmail")

vmsgbody = vfromname &"<br>"& vrplyto &"<br>"& vbody

 

Set objEmail = Server.CreateObject("Persits.MailSender")

 

objEmail.Username = vfromaddress

objEmail.Password = vfrompwd

objEmail.Host = vmailhost

objEmail.From = vfromaddress

objEmail.AddAddress vtoaddress

objEmail.Subject = vsubject

objEmail.Body = vmsgbody

objEmail.IsHTML = True

objEmail.Send


vErr = Err.Description
if vErr <> "" then
    response.write vErr & "<br><br>There was an error on this page."
else
    response.write "Thank you, your message has been sent."
End If
 

Set objEmail = Nothing
end if

%>

 

<html><body>

<form name="SendEmail01" method="post">

<table border=0>

<tr>

            <td>Name:</td>

            <td><input type="text" name="TName" size="30"></td>

</tr>

<tr>

            <td>Email:</td>

            <td><input type="text" name="TEmail" size="30"></td>

</tr>

<tr>

            <td>Body:</td>

            <td><textarea rows="4" name="TBody" cols="30"></textarea></td>

</tr>

<tr>

            <td><input type="submit" name="Submit" value="Submit"></td>

</tr>

</form>

</body></html>