Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Sending Emails from DBPro using Outlook

Author
Message
Visigoth
20
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 28th Oct 2010 07:54 Edited at: 28th Oct 2010 08:03
I came across a situation where I needed to automatically send an email with data from a DBPro project. The "method" I came up with is to shell execute Outlook using the DBpro command "execute file".
Outlook, (and Outlook Express), allows launching from the command line with switches.
So, for example, this line of code:

execute file "Outlook.exe","/c ipm.note" ,"C:\Program Files\Microsoft Office\Office11"

would launch Outlook and open an email message, unpopulated.
Now, there are several switches, available here:

command line switches for Outlook

But the real beauty of using Outlook, as opposed to Outlook Express or Thunderbird (Thunderbird also works with command line, btw) is that you can use Visual Basic for Applications (VBA) within Outlook to automate email.
That means, a macro could be written, and called from within the startup event or login event to automatically send emails.

This option, to me, is better than using something like Blat, because Blat doesn't work with mail that uses SSL. You need another tool to bypass this, and it all starts to get quite messy.

The disadvantage to this option is, Outlook is $139.00, alot of money. However, you can get a 60 day free trial version of the entire Office suite.

And I bet older versions of Outlook could be had for alot less than that.

In my case, I'm using DB and the DBConn plugin to query an Access database. Then, I write the results into a text file. I then call Outlook, and have a macro I wrote to create, populate, attach the file, and send the email.

The only issue is security settings in Outlook. Unless the macro project is digitally signed, you will get a warning everytime Outlook launches. I have 2 methods to get past this. Digitally sign the macro using the self signing tool :

Digital signature

OR

just "allow all macros to run" in the security settings. I'm testing the digital signing now, but won't be able to verify it works on another pc until tomorrow, but I think it should, once it is accepted as trusted.

So, just thought I'd share this info.

Here is another link on getting started with VBA if you are not familiar with it.

Getting started with VBA
Flatlander
FPSC Tool Maker
18
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 20th Nov 2010 15:01
This sounds interesting. Let us know how you are coming along with this.

I reject your reality and substitute my own!

Add more adventure to your game -- use RPG Mod
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 20th Nov 2010 15:12
sladeiw
15
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 20th Nov 2010 20:43 Edited at: 20th Nov 2010 20:44
You can launch your default mail client populated with details by using mailto: but there is a limit of around 2000 characters depending on which client you use. (May be a lot shorter)



You also need to make all the strings url-safe.

Login to post a reply

Server time is: 2025-05-07 14:01:59
Your offset time is: 2025-05-07 14:01:59