Portal Home > Knowledgebase > ASP Programing > How to use ASP Email ?


How to use ASP Email ?




AspEmail 5.0 is an active
server component for sending
e-mail messages using an
external SMTP server in an
ASP or VB environment.
AspEmail 5.0 supports
multiple recipients,
multiple file attachments,
HTML format, embedded images
and sounds, non-US ASCII
character sets, secure mail,
and high-performance message
queuing.

 


Sample Codes:


01.
<%


02. strHost =
"mail.serverhost.com"

03. If
Request("Send")
<> "" Then

04.  
Set
Mail =

Server.CreateObject
("Persits.MailSender")

05.   Mail.Host = strHost


06.   Mail.From =
Request("From")

07.   Mail.FromName =

Request
("FromName")

08.   Mail.AddAddress

Request
("To")


09.   Mail.Subject =

Request
("Subject")

10.   Mail.Body =

Request
("Body")

11.   strErr = ""

12.   bSuccess = False

13.   On
Error
Resume
Next

14.   Mail.Send

15.   If
Err <>
0 Then

16.      strErr =
Err.Description

17.   else

18.      bSuccess = True

19.   End
If

20.
End If


21.
%>


 



Explanation According to
Line


01. Open
ASP tag


02. Set the strHost variable
with the email server host
name


03. Checking whether
the data passed by a html
form is empty or not


04. Set Mailer control
properties and collection
items


05. Set Mailer control
properties and collection
items


06. Set Mailer control
properties and collection
items


07. Set Mailer control
properties and collection
items


08. Set Mailer control
properties and collection
items


09. Set Mailer control
properties and collection
items


10. Set Mailer control
properties and collection
items


11. Set the strErr variable
to empty


12. Set the bSuccess
variable to False


13. If there is error, go to
the next line


14. Send email


15. If the error occur then
go to line (16)


16. Display error
description


17. If the no error occur go
to line (18)


18. Set the bSuccess
variable to True upon
success


19. end if statement on line
(15)


20. end if statement on line
(03)


21. Close ASP tag


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
How to use Jmail ? (Views: 41)