Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Send Outlook Email From ASP Page? 1

Status
Not open for further replies.

byrne1

Programmer
Aug 7, 2001
415
US
Does anyone know how/if you can send Outlook Email from an ASP page? I've searched and found the code listed below but this causes my IIS to hang (no error messages, just hangs). Thank you in advance for any help!


Sub SendMailOutlook(aTo, Subject, TextBody)

'Create an Outlook object
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")

'Create e new message
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message

.Subject = Subject
.Body = TextBody

'Set destination email address
.Recipients.Add (aTo)

'Send the message
.Send
End With
End Sub
 
Yes. Use CDONTS. If you are writing using VBScript, you will need to include the CDOVBS.INC include file. You can get this from Microsoft's site.

Here's an example of where I am sending Help Desk notification of a new help desk request using CDONTS.



set objMail = Server.CreateObject("CDONTS.Newmail")
objMail.From = USER_ID & "@TheCareGroup.com"
objMail.To = "HelpDesk@TheCareGroup.com"
objMail.Subject = "New Login Request"
objMail.Body = "A(n) " & strReqType & " Login Request - (Ticket # " & nTicketNo & ") has been entered by " & strSName & " please respond"
objMail.Send
set objMail = Nothing


Hope this was helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top