Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1700
  • Last Modified:

Javascript button to open Outlook (12) 2007 New message

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
colonelblue
Asked:
colonelblue
2 Solutions
 
ziffgoneCommented:
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
 
colonelblueAuthor Commented:
Hey and thank you. How do I add that to a button if I may ask?
0
 
ojohnsonCommented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now