Send email via C# From InfoPath Form - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Send email via C# From InfoPath Form

Last post 07-08-2016 05:45 AM by ISUGraber. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-07-2016 01:49 PM

    Send email via C# From InfoPath Form

     I'm trying to send an email from InfoPath after my code has run updating the tables I have on the back end.  I got this to work with SMTP but in order for that to work my form would need to be set to Full Trust.  So I started trying to work with ADO Query and call a stored procedure to do this.  Problem is when I call the stored procedure I don't get an error message but it doesn't seem to reach the Server since I don't see my emails in the logs.  Below is the code I'm trying to use.  I setup a basic data connection to my server and I try to adjust it to get my email out.  Does an yone have any thoughts?  Maybe there's another way to call a stored procedure without needing Full Trust?

     

    //Not submitting, emails are not being delivered


    AdoQueryConnection connEmail =


    (AdoQueryConnection)DataConnections["QV_SendEmail"];




     



    connEmail.Command = "EXEC msdb.dbo.sp_send_dbmail " +


    " @recipients = 'Me@Somewhere.com', " +


    " @body = 'User has submitted an access request from InfoPath" + Last_Name + "', " +


    " @subject = 'Access Request has been submitted via InfoPath' ; ";




    connEmail.Execute();

     

  • 07-07-2016 01:59 PM In reply to

    Re: Send email via C# From InfoPath Form

    Can you modify your stored proc to set implicit transactions to off and see if that makes a difference?
    Hilary Stoupa

  • 07-08-2016 05:45 AM In reply to

    Re: Send email via C# From InfoPath Form

    Thanks again Hilary!  You're a rock star!  That seems to be working!

     

    Glad I found this forum!   

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