how to send email from an asp page ?

  • Thread starter Sivaswami Jeganathan
  • Start date
S

Slim

Sivaswami Jeganathan said:
how to send email from an asp page ?



try this, exchange server example below, remote server below that


' via stmp
Sub sendEmail(whoTo, subject, body)
Dim iMsg
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 1
Const strPickup = "c:\Inetpub\mailroot\pickup"
Set iMsg = CreateObject("CDO.Message")
Set iConf = iMsg.Configuration
With iConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPickup
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")
= strPickup
.Update
End With
With iMsg
.To = whoTo
.From = "(e-mail address removed)"
.subject = subject
.HTMLBody = body
.Send
End With
End Sub

'via exchange pickup
Sub sendEmail(whoTo, subject, body)
Dim iMsg
Dim iConf
Dim Flds
Const cdoSendUsingPickup = 1
Const strPickup = "c:\Program Files\Exchsrvr\Mailroot\vsi 1\PickUp"
Set iMsg = CreateObject("CDO.Message")
Set iConf = iMsg.Configuration
With iConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPickup
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")
= strPickup
.Update
End With
With iMsg
.To = whoTo
.From = "(e-mail address removed)"
.subject = subject
.HTMLBody = body
.Send
End With
End Sub

'via remote server
Sub sendEmail(whoTo, subject, body)
Dim iMsg
Dim iConf
Dim Flds
Const mailServer = "yourmailserver.com.au"
Const cdoSendUsingPickup = 2
'Const strPickup = "c:\Program Files\Exchsrvr\Mailroot\vsi 1\PickUp"
Const strPickup = "c:\Inetpub\mailroot\pickup"
Set iMsg = CreateObject("CDO.Message")
Set iConf = iMsg.Configuration
With iConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPickup
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
mailServer
.Update
End With
With iMsg
.To = whoTo
.From = "(e-mail address removed)"
.subject = subject
.HTMLBody = body
.Send
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top