Solved

Javascript button to open Outlook (12) 2007 New message

Posted on 2009-05-06
3
1,652 Views
Last Modified: 2012-05-06
Hello the code below was made for a button to open a new outlook message prior to Outlook 12 ( 2007 ). Is there a way to modify this to make work with 2007?

Thanks advance.
<script language="JavaScript" type="text/JavaScript">
 

function genNewEmail()
 

{
 

  try
 

  {
 

    o = new ActiveXObject("Outlook.Application");
 

    if(o)
 

    {
 

      mailFolder = o.getNameSpace("MAPI").getDefaultFolder(6);
 

 
 

      //You could also use custom forms like IPM.Note.CustomForm
 

      mailItem = mailFolder.Items.add("IPM.Note");
 

      mailItem.Display(0)
 

    }
 

  }
 

  catch(e)
 

  {
 

    window.status = e.Message;
 

  }
 

}
 

</script>
 

 
 

<input type="button" value="New Message" NAME="cmdNewMessage" OnClick="genNewEmail()">

Open in new window

0
Comment
Question by:colonelblue
3 Comments
 
LVL 14

Accepted Solution

by:
ziffgone earned 250 total points
ID: 24331182
Well, if Outlook is your default email client, you could simply go with this:


<script type="text/javascript">

top.location.href="mailto:user@domain.tld";

</script>

Open in new window

0
 

Author Comment

by:colonelblue
ID: 24361177
Hey and thank you. How do I add that to a button if I may ask?
0
 

Assisted Solution

by:ojohnson
ojohnson earned 250 total points
ID: 24385845
function openEmail()
      {
      var email="user@domain.com"                        
        top.location.href="mailto:"+email;
                  
      }

<form name="myform">
  <input type="button" name="email" value="Send Email" onclick="openEmail();" />

</form>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now