Submitting forms - InfoPath Dev
in

InfoPath Dev

Submitting forms

Last post 08-26-2005 12:19 AM by Patrick Halstead. 19 replies.
Page 2 of 2 (20 items) < Previous 1 2
Sort Posts: Previous Next
  • 08-24-2005 11:43 PM In reply to

    • dominic
    • Not Ranked
    • Joined on 11-24-2004
    • Australia
    • Posts 8
    Ok if you have outlook try this it should work. Simply call the funtion from the
    function CTRL239_2::OnClick(eventObj){
    <Call the function Here, make sure you pass the appropriate paramaters>
    for example:
    mailMessage([email protected],"Test Message",[email protected],[email protected]);
    }
    If you don't want to CC to someone, or BCC for that matter you don't have to just leave ther paramater out, but make sure you still leave the commas in.

    Past this function (the one your going to call above) into you jscript file.
    /*------------------------------------------------------------------------------
    Automatic mail function
    ------------------------------------------------------------------------------*/

    function mailMessage(to,subject,cc,body,bcc){
    try
    {var myOlApp = new ActiveXObject("Outlook.Application");
    newMail = myOlApp.CreateItem(0);
    newMail.To = to;
    newMail.Subject = subject;
    newMail.CC = cc;
    newMail.Body = body;
    newMail.Send();
    }
    }
    catch(ex)
    {
    XDocument.UI.Alert(ex.description);
    }
    }
  • 08-24-2005 11:57 PM In reply to

    • dominic
    • Not Ranked
    • Joined on 11-24-2004
    • Australia
    • Posts 8
    Ok if you have outlook try this it should work. Simply call the funtion from the onclick event for the button e.g.:

    function CTRL239_2::OnClick(eventObj){
    <Call the function Here, make sure you pass the appropriate paramaters>
    for example:
    mailMessage("[email protected]","Test Message", "[email protected]",XDocument.DOM.xml,"[email protected]");
    }
    If you don't want to CC to someone, or BCC for that matter you don't have to just leave the paramater out, but make sure you still leave the commas in and put "". I have tried it and it works for me, brings up an e-mail with the xml in it.

    Paste this function (the one your going to call above) into you jscript file as well.
    /*------------------------------------------------------------------------------
    Automatic mail function
    ------------------------------------------------------------------------------*/

    function mailMessage(to,subject,cc,body,bcc){
    try
    {
    var myOlApp = new ActiveXObject("Outlook.Application");
    newMail = myOlApp.CreateItem(0);
    newMail.To = to;
    newMail.Subject = subject;
    newMail.CC = cc;
    newMail.BCC = bcc;
    newMail.Body = body;
    // if you want to see the e-mail b4 sending use
    newMail.Display(0);
    //If you want to send automatically use:
    newMail.Send();
    }
    catch(ex)
    {
    XDocument.UI.Alert(ex.description);
    }
    }

    this is how I generate most of my mails, hope this helps.
  • 08-25-2005 01:40 AM In reply to

    • oguz
    • Not Ranked
    • Joined on 08-19-2005
    • Posts 18
    Thanks Dominic. I'll try it
  • 08-25-2005 02:07 AM In reply to

    • oguz
    • Not Ranked
    • Joined on 08-19-2005
    • Posts 18
    Ok the email problem is solved but how can add an attachment to the e-mail, or can I put the mht file to the body of the mail. I read in anaother topic by Patrick Halstead that we can use Export method ( XDocument.View.Export("C:\\MyView.mht", "MHT"); Now I have a MHT file in my disk. Can I put it into the email as body.
  • 08-26-2005 12:19 AM In reply to

    Should be able to. Just add it as Body text.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
Page 2 of 2 (20 items) < Previous 1 2
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.