Hey Alan, This looks VERY Interesting what you did. Since Stephen has prodded me in the recent past to dabble in PowerShell - I kind of knew that he would add his 2 cents to this topic - and I'm glad he did.
This also sounds like something you should Definitely get posted to the ProFox Archives/Downloads section! -K- -----Original Message----- From: ProfoxTech [mailto:[email protected]] On Behalf Of Alan Bourke Sent: Thursday, November 12, 2015 5:01 AM To: [email protected] Subject: Sending SMTP emails from VFP using PowerShell. As part of researching a project I noticed that PowerShell has a cmdlet called Send-MailMessage which can send an SMTP mail. It supports HTML body or plain text, multiple recipients, attachments, priority, failure notification, SSL/TLS and SMTP authentication if needed. (I suspect it is using the .Net System.Net.Mail.SmtpClient namespace internally) I have knocked up a quick class to demonstrate how to use it to send SMTP email on the VFP Wiki: http://fox.wikis.com/wc.dll?Wiki~SendSmtpEmailWithPowershell Broadly speaking the class wraps functionality that will generate a PowerShell script file (.PS1) and then run that using Windows Scripting Host. One drawback is that it doesn't support inline images. So to include an image in a HTML body you need to use an image tag with a resolvable URL to the image, meaning resolvable by the recipient so either in a public location on your own server, or on a third-party content server. The way round that is inline images, where you add an inline image and then just refer to it with a ContentID in the <img> tag, i.e.: <img src="cid:mylogo"> The comments in the PRG refer to an enhanced version of the Send- EmailMessage cmdlet that *does* support inline images, so go for that if you need to. You could look on this as analogous to using Blat from VFP, except without the faff involved in using Stunnel to overcome Blat's lack of SSL/TLS support. That support is vital for for sending via Exchange Online, Gmail and so on. The PRG requires at least PowerShell 3.0, which will be already present on anything running Windows 7 SP1 onward, or Windows Server 2008 SP1/ Windows Server 2008 R2 onward on the server side. So forget about it on XP or Vista. -- Alan Bourke alanpbourke (at) fastmail (dot) fm --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/80838f1ca795b14ea1af48659f35166f259...@drexch02.corp.globetax.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

