问题
I'm looking for a way to send an InfoPath form programmatically, equivalent to using the quick publish button in the InfoPath designer, but without using any UI.
I was not able to find a way to do this, I have tried using MailEnvelope , but it brings up an UI and I don't want that.
So I ended up sending the current form file through a SmtpClient, but then the form shows up as a regular attachment.
Does anyone know if there is a possibility to do that from code, or not?
Thanks in advance.
回答1:
You can use SmtpClient with attachments but you have to set the MIME types for the attachments and headers on the email. Instead of copying the full article here, see this link: http://blogs.msdn.com/b/hanuk/archive/2008/03/18/how-to-display-infopath-forms-inline-with-outlook-email-message.aspx
来源:https://stackoverflow.com/questions/11618470/programmatically-publishing-an-infopath-form-sending-as-email