Solved

cfmail an outlook task

Posted on 2004-08-12
12
371 Views
Last Modified: 2013-12-24
Is anyone aware of a way to email someone an outlook task using CF, or for that matter, any language?
0
Comment
Question by:theamzngq
  • 7
  • 4
12 Comments
 
LVL 1

Expert Comment

by:patbuchanan
ID: 11797462
Since Outlook does not support the VTODO element of the iCal standard, you would have to use Outlook objects, which means client, not server code.  The only way I could think of is to email them a LINK that goes to a page on your server and generates some VB Script code that instantiates the Outlook object and creates a task.

I have some samples of how to do that for emails but not tasks.  But it may give you a head start.  Interested?
0
 
LVL 1

Expert Comment

by:patbuchanan
ID: 11797637
By the way, instantiating Outlook on the end-users machine will generate security warnings so you will want them to add your site into their trusted sites list.  

Here is some sample code.  Just do something like this:

Set objOL = CreateObject("Outlook.Application")
Set myItem = objOL.CreateItem(3)
myItem.Assign
Set myDelegate = myItem.Recipients.Add("Pat Buchanan, George Bush")
myItem.Subject = "Slap around Mr. Kerry"
myItem.DueDate = #12/31/2004#
myItem.Send

You might have to debug the above code - have not tested it.

Also, here is some code to determine if Outlook is already running before you try to start it up.  Otherwise you MIGHT get "can't create object errors"

Function OpenOL(Optional ProfileName) As Outlook.Application
    Dim objOL As Outlook.Application
    On Error Resume Next
    Set objOL = GetObject(, "Outlook.Application")
    If objOL Is Nothing Then
        Set objOL = CreateObject("Outlook.Application")
        objOL.Session.Logon ProfileName, , False, True
    End If
    Set OpenOL = objOL
    Set objOL = Nothing
End Function
0
 
LVL 2

Author Comment

by:theamzngq
ID: 11797853
Most of this is unfamiliar to me, and therefore may be beyond me.  I don't have any VB experience, just CF, HTML, CSS, and JS.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 1

Expert Comment

by:patbuchanan
ID: 11797860
I have yet to find a way to do it using server side.  Outlook just doesn't support it.  I could send you a 100% working snippit that creates EMAILS on the client side using Outlook.  Would that help?

-Pat
0
 
LVL 2

Author Comment

by:theamzngq
ID: 11797862
sure
0
 
LVL 1

Expert Comment

by:patbuchanan
ID: 11797925
I'm at work where I don't have the code - it's at home.  Can I send it to you later?
0
 
LVL 1

Accepted Solution

by:
patbuchanan earned 500 total points
ID: 11837031
Sorry this took so long - I forgot.....

==============================

<script language="VBScript">
      sub EmailSample()
            const olMailItem = 0
        //Create an object to interact with Microsoft Outlook
            set objOutlook = createobject("Outlook.Application")
            //Create a new mail message
            set objMail = objOutlook.createitem(olMailItem)
            //fill in who the message is to
            objMail.To = "bill@microsoft.com"
            //create the subject line
            objMail.subject = "CF over ASP"
            //Create the Body in HTML format.  You can use objMail.body if you want plain text instead of HTML
            message = message + "<b>Hello</b> there Bill"

            objMail.HTMLBody = "<HTML><BODY>" + message + "</BODY></HTML>"

            //Use .display to display the message before sending
            //You could use objMail.Send to send the message without reviewing it first
            objMail.display
            //clean up
            set objMail = nothing
            set objOutlook = nothing
      end sub
</script>
0
 
LVL 2

Author Comment

by:theamzngq
ID: 11841771
so how do I implement/test this?  I have never used VBScript.  Can it be used or called in a web page?
0
 
LVL 1

Expert Comment

by:patbuchanan
ID: 11842146
To test it, just create an basic HTML page, and paste the above code into it.

Now you need something to call the function.  You can make it "auto-run" by just calling the function right after you declare it, by adding this line:

EmailSample

directly below the "end sub" line, but still inside the <script> tags.

If you wanted to call it based on a button click, you could instead place this code in the <body> of your page:

<button onclick="EmailSample">Send Email</button>

There are a bunch of VBScript / JavaScript tutorials on the web that will get you up to speed in 1 day (it's pretty simple in some ways).  As you delve deeper into "outside of the box" web programming like automation (what we are doing above) learning VBScript/JavaScript is essential.

Thanks!
-Pat




0
 
LVL 2

Author Comment

by:theamzngq
ID: 11842244
I use JS all the time, so if its similar to VBS, then I should be just fine.
0
 
LVL 1

Expert Comment

by:patbuchanan
ID: 11843139
Yep - it's pretty close.  Just a few different annoyances, like:

EmailSample

instead of

EmailSample()

like in JS.

You'll like it in some ways and hate it in others.  :)  I think VBScript has much better support for date formats, for example.

Hope that helped you!

-Pat
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question