Sending email from IDL
(Note: This is a guest post from Eduardo Iturrate, who is not only a director of sales at Exelis VIS, but he’s also an IDL master: he created RevolutionIDL, the Source Code Generator for Beginners, Katalog, the ENVI Program Generator and the ENVI5 – Google Maps Link. Thanks, E! –MP)
The following technique uses IDL, PHP and a regular web server to send emails initiated by an IDL program. This can be useful in situations where you want IDL to notify you that it’s finished a long process.
This code uses the imaginary “webserver.com” server name. You will have to change that to your own server name, both in the IDL and PHP code.
Use a text editor to create the following file, named idlsendmail.php
. Remember to change “email@example.com” to an address that includes your domain name.
Upload this idlsendmail.php
file to your web server. Put it in your main web directory – if you move it to a particular subdirectory, make sure to point to it in the call from IDL.
At this point, all we need to do from IDL is:
IDL> oUrl = obj_new('IDLnetUrl')
IDL> to = 'firstname.lastname@example.org' ;Use your own email address here
IDL> ok = oUrl->Get(URL='http://www.webserver.com/idlsendmail.php?email='+to, /STRING_ARRAY) ;Change webserver.com to your domain name
IDL> obj_destroy, oUrl
An email should appear in your inbox shortly afterwards. If not, check your spam folder!
: Fernando Santoro also has a related example
of using IDL and PHP on the VIS Code Library.