Search Tools Links Login

Jmail email example in asp


The sole purpose of this article is to help those who could not figure out the right purpose of jmail object in asp....Just a simple example to send emails using jmail object...

Original Author: pompyk

Code

JMAIL:


' Create the JMail message Object

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



' Set logging to true to ease any potential debugging

' And set silent to true as we wish to handle our errors ourself

msg.Logging = true

msg.silent = true


' Most mailservers require a valid email address

' for the sender


'This email address I guess must be that which is provided when u booked
'your domain....




msg.From = "changeme@change.com"

msg.FromName = "SOMDUTT GROUND BOOKING"



' Next we have to add some recipients.

' The addRecipients method can be used multiple times.

' Also note how we skip the name the second time, it

' is as you see optional to provide a name.


msg.AddRecipient "gangulysomdutt@yahoo.com", "SOMDUTT"

'msg.AddRecipient "recipientelle@herDomain.com"



' The subject of the message

msg.Subject = "WHATEVER U LIKE"

'don't use the same..u must make a html form...using it..

'so that u can submit it...

' Note the use of vbCrLf to add linebreaks to our email



msg.Body ="Name: " & request.form("name") & vbcrlf & _

"Address: " & request.form("address") & vbcrlf & _

"City: " & request.form("city") & vbcrlf & _

"Zip: " & request.form("zip") & vbcrlf & _

"Phone: " & request.form("phone") & vbcrlf & _

"Email: " & request.form("email") & vbcrlf & _

"Fax: " & request.form("fax") & vbcrlf & _

"Car: " & request.form("listcar") & vbcrlf & _

"Bus: " & request.form("listbus") & vbcrlf & _

"Utilisation Start Date: " & request.form("txtDate") & vbcrlf & _

"Utilisation End Date: " & request.form("txtDate2") & vbcrlf & _

"Payment Preference: " & request.form("select") & vbcrlf & _

"Places to be visited: " & request.form("place")



' To send the message, you use the Send()

' method, which takes one parameter that

' should be your mailservers address

'

' To capture any errors which might occur,

' we wrap the call in an IF statement

'if not msg.Send("mail.myDomain.net" ) then




if not msg.Send("202.71.139.79" ) then

  Response.write "
" & msg.log & "
"

else

  Response.write "Message sent succesfully!"

end if


' bye bye...go u have done it!!..thx..


'-------------------------------------------------

'-----mail......ends...............................




This is just a little help to those who got entangled in JMAIL

gangulysomdutt@yahoo.com


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 140 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.