Sending an email issue - InfoPath Dev
in

InfoPath Dev

Sending an email issue

Last post 04-29-2008 01:26 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-23-2008 11:51 PM

    Sending an email issue

    Hi Guys,

     I am using the following code to send an email and then closing the application.  It works

    Code:

    XDocument.UI.ShowMailItem("[email protected]", "", "", "subject", "Body");

    XDocument.UI.Alert("The e-mail message has been sent.");

    Application.ActiveWindow.Close(true);

    Problems:

    It opens up MS Outlook and prompts them to send the email.  Is there anyway I can skip it from opening MS Outlook.

    Any advise is appreciated.

    Thanks

     Dave

    Dave
  • 04-24-2008 05:01 PM In reply to

    You can do 2 things:

    1. Use the Mail Envelope instead (which shows the To:, CC: etc, right in InfoPath):

    Application.ActiveWindow.MailEnvelope.To = "Greg";
    Application.ActiveWindow.MailEnvelope.Visible =
    true;

    2. You can get the email data connection, set the field values, and the submit it via code.

     

  • 04-27-2008 07:49 PM In reply to

    I tried your code and Infopath kept on giving error message. 

    I tried this code and it worked.

    XDocument.View.Window.Close(true);

    Thanks for your support.

    Dave

    Dave
  • 04-29-2008 01:26 PM In reply to

    Glad you got it working. I thought the question was about the email, not about the close. It looks like all you did was delete the lines that sent the email and did the alert. If you did not want to send any email, then this was the right choice. If you just wanted to stop the email from being opened in Outlook -- but still send it -- then you need a different solution.

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.