Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 22nd, 2010, 07:46 AM
Authorized User
Join Date: Sep 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default CDO.Message and Outlook

Hi to All,

I have this kind of problem.
I have a page index.asp, in which there is a button that onclick recalls another page called mail.aspThis is the content of mail.asp:

<%@ Language=VBScript %>
Option Explicit
Dim mail, sender
sender = Request.Form("user")
Set mail=CreateObject("CDO.Message")
mail.To="[email protected]"
mail.From="[email protected]"
mail.Subject="The Ticket has been SUBMITTED !"
mail.HTMLBody="<b>Proj: &nbsp;</b>" & Request.Form("proj") & "<br>" &_
"<b>Product: &nbsp;</b>" & Request.Form("pro") & "<br>" &_
"<b>User: &nbsp;</b>" & Request.Form("user") & "<br><br>" &_
"<b>Notes: &nbsp;</b>" & Request.Form("notes_2") & "<br><br>"
Set mail=nothing

This code is perfect but:

using CDO.Message we have no certainty that the receiver receives well the email,
there is no way to alert if the email, for some reasons (maybe related to some problem of internal server) don' t arrive at destination.
In fact we used this way of sending email and sometimes emails will not arrive, and we don' t know why.

So I ask if it is possible that when the user fills the fields in the form of index.asp, and push the button that recalls mail.asp,
can send email using CDO.Message but via Microsoft Outlook, that is the official intranet application for the emails.
In this case the user is sure that the different fields are good and, clicking send, can submit the email to the receiver.

I know that ASP is in server side and Outlook is member of client side ...

I have found in internet this useful link:


that tells that is possible to send email using CDO.Message and Outlook.

I have tried to create a page mail.asp in this way but happens nothing:

<%@ Language=VBScript %>
Option Explicit
Dim Outlook
Set Outlook = CreateObject("Outlook.Application")
Dim Message, aFrom, aTo
aFrom = "[email protected]"
aTo = "[email protected]"
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = "Ciao"
.Body = "Test"
.Recipients.Add (aTo)
Const olOriginator = 0
If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
End With

Thanks in advance !!!
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Source: CDO.Message.1 please help me:) ilknur SQL Server 2000 1 July 23rd, 2006 12:52 PM
Need help related CDO.Message shankhan Classic ASP Basics 9 January 2nd, 2005 07:08 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.