- Passing Email Commands to Print Wizard
- Additional Information on Email Methods
- Email Through gmail
- More Examples
- Fields and Formats
- The Future
- More on Testing CDO
Print Wizard has email support for several email engines available to Windows and we continue to add to this list. The ones we list here all have their advantages, and may or may not be installed on your PC. You will want to play with them to see what works best for your Windows configuration and for your email server.
One thing to keep in mind, automating email services is difficult in many environments. There has been so much concern over security that what may seem trivial, such as sending an email notice, can become difficult to implement.
Print Wizard supports emailing from a number of different sources including through the Print Wizard user interface, direct from the Print Wizard engine, from the Print Wizard DLL, from the Web Print Object, WēPO or from a bang command embedded in the print data.
Through the Print Wizard user interface, you can select a file, and choose to email it, utilizing any of the methods available. Also through the user interface you can set up how default emailing behaves and define each email engine’s default settings.
- Print Wizard Engine
The Print Wizard engine can be called directly from a third-party program or script, or with the use of command-line parameters, to process a print job and email it as an attachment.
- Print Wizard DLL
The Print Wizard DLL also contains some limited capabilities for emailing.
Through the ActiveX version of Print Wizard, WēPO can be instructed to do emailing.
- Bang Commands
Bang commands can be added to a print job file to do a single email or multiple emails by just passing the file through the Print Wizard engine.
All of the email protocols supported by Print Wizard require different setup items to successfully connect to an email server or gateway, and your email server or email gateway may not allow access from all of these variations. Likewise, certain firewalls and routers, both on the local PC and on your network, may block some of these protocols. It is important to understand each of these and their strengths and weaknesses.
Collaboration Data Objects are automation compatible object models that wrap MAPI for easier use. Whereas MAPI requires some configuration, CDO handles this for you and makes some assumption to simplify sending and receiving of email, faxes and calendar events. We have implemented the sending of email within the Print Wizard engine.
There have been reported problems with CDO if Outlook is not already installed on the PC. Outlook supports extended MAPI, Outlook Express supports simple MAPI and the CDO COM objects use extended MAPI. So if you currently have only Outlook Express loaded, you will need to either install Outlook or install extended MAPI support through some other application.
The Messaging Application Programming Interface comes in various flavors with support for many 3rd party applications such as Outlook (MAPI), Outlook Express (Simple MAPI), Exchange (Extended MAPI), and others. Print Wizard implements standard MAPI with support for sending of email and the handling of Outlook profiles. MAPI is available on most all Windows platforms that include Microsoft Office in some form or another.
For those users with Outlook installed, Outlook provides object level interfaces direct to the program. Print Wizard has implemented the basic calls for sending email directly into Outlook, obeying any rules, permissions and profiles that Outlook has defined.
The advantage of Outlook is that all sent emails and returns are tracked inside Outlook. MAPI and CDO do not have any tracking or logging as they are simply one-way, outbound, protocols as implemented in Print Wizard.
The disadvantage of Outlook is that when implemented for sending emails, it does not automatically send. If Outlook is not up and not set for auto send/receive, the emails will wait till another send/receive action takes place. This may require Outlook being started by the user, or even for the user to press send/receive.
The Simple Mail Transport Protocol is the standard Internet protocol for transporting email messages. The implementation of SMTP by Print Wizard assumes that your Windows machine has permissions to send email through your local email gateway (using the email gateway as a relay). This may not always be the case, but usually if any of the above methods work, this will.
This protocol is more for direct emailing and requires that the email server you use allows for remote clients to relay emails. Many server setups, such as Exchange server's default settings, do not allow relaying emails from external clients. Check with your email administrator.
If you are using an email service, such as gmail or yahoo, check their support pages for POP or SMTP support. If they allow POP for inbound traffic, such as for Outlook, they often also have a way to turn on SMTP for outbound traffic. See our notes below on Email through gmail.
Sending email through Print Wizard can be accomplished through several different methods.
- Print Wizard's User Interface
- Print Wizard command-line parameters
- Print Wizard profiles
- Print Wizard Services or Windows Services for Print Wizard
- Bang commands
Print Wizard's User Interface
From within the Print Wizard User Interface you can select/open a file to print or fax or generate a PDF, or email. When you do email from the user interface, a dialog will pop up asking for various email information, such as the TO name and message body and subject line. The file you opened will become the attachment for the email.
Print Wizard Command-Line Parameters
There are several command line parameters used for email (certain required items may be pulled from default email type). Additional details are included elsewhere in this document on each parameter:
/confirm=on / off
/email=<to address> (use defaults in printwiz.ini)
/emailbcc=<bcc to addresses>
/emailcc=<cc to addresses>
/emailfrom=<from name> (required for all types)
/emailfromaddress=<from address> (optional for all types)
/emailhtml=on / off
/emailpass=<password> (optional for smtp)
/emailport=<port #> (optional for smtp)
/emailprofile=<Outlook/MAPI profile> (required for MAPI, Outlook)
/emailserver=<server> (required for CDO, smtp)
/emailuser=<user> (optional for smtp)
/a<attachment or CSV list of attachments> (optional for all types)
/n<notes or note include file> (optional for all types)
/j<subject line> (optional for all types)
/t<to name> (optional "to" name for all types)
Print Wizard profiles
One of the best, but oft misunderstood, features of Print Wizard are "print profiles" A Print Wizard print profile is a stored configuration of options that allow you to repeat a process that worked before. Print profiles contain information on margins, page sizes, initialization files to use, overlay files to use, fax information and email information.
Within a print profile you can set all the server information you want to use for a specific job. this allows the server and email method to be different for different jobs. Likewise, if you wanted to always send emails to the same person, you can even set up a print profile that contains the outbound information, such as message body and subject, and even the TO address.
Print Wizard Services or Windows Services for Print Wizard
Print Wizard services include a "listen" service, a "despool" service, an "lpd" service and an "ftp despool" service. These all pull print job requests from remote sources and pass them through Print Wizard. These services can either run as a stand-alone user service, we call these "Print Wizard Services" or as a Windows Service, where no user need be logged in for the service to work.
Each of these services can be set up to receive a print job and email it. However, the issue is how to provide the necessary email information for the job.
- You could set up a print profile and associate that print profile to the service, and include the email TO address and other email information in the profile. This only works if every job should be emailed to the same person.
- You could set up the service to pop-up the user dialog asking for an email address, subject, message body, etc. But this would require someone logged in and watching for these jobs. And this will not work with Windows Services as there is no user interface provided in this environment.
- The only flexible way to provide adequate email support for remote print services is through "bang" commands. By including a bang command in the print job, the job can tell Print Wizard where to email to and provide a subject and message body, all inside the print job. This allows a host application or database to formulate how to email the job.
“Bang” commands refers to a line inserted within a print job "stream" that begins with an exclamation mark immediately followed by a reserved word and optional parameters. The exclamation mark / reserved word combination must be the first printable characters in the print job for the file to be designated as containing subjobs. Likewise, each subsequent bang command (plus parameters) must occupy its own line, i.e. they must follow a line-feed and end in a line-feed.
With the inclusion of “bang” commands, multiple print jobs can be processed by the Print Wizard engine even though they come from the same source file. This includes the emailing of various parts of a file to multiple email addresses. For more details on "bang" commands, see our support document Print Wizard Bang Commands.
!EMAIL uses the default email settings found in the “printwiz.ini: file as were set via the Print Wizard user interface.
!MapiSend saves all the following data off to a file that then processes that temporary file via the stand-alone MapiSend program. Any included switches are passed on to the stand-alone MapiSend program (see the MapiSend section later in this document). In this manner the data can be faxed or emailed according to the MAPI protocol and the Outlook profile.
!MapiSend does take advantage of the “Expand Variables” procedure described in the Appendix for placing Print Wizard global variables as command line parameters.
Through the use of a PDF bang command, you can instruct a subjob to generate a PDF and then attach that PDF to an email. Refer to the various support documents on PDF generation for additional information.
A number of optional parameters can also be included when doing emails with bang commands. Please refer to documentation below for format possibilities for these parameters. Here is a list of available bang parameters:
/EMAILBCC=<bcc to addresses>
/EMAILCC=<cc to addresses>
/F<pdf file name for !pdf>
/N<notes for message body>
/P<profile for !MAPI>
The first example, emails the included data to a couple of different sources using the MAPI protocol and an “Outlook” profile:
!mapisend /pOutlook /firstname.lastname@example.org
The second example generates a PDF via the Acrobat PDF Writer printer driver and emails the generated PDF file using MAPI:
!acrobat /email@example.com /pOutlook /n"note line 1|note line 2" /j"subject" /ac:\printwiz30\test.doc
The third example generates a PDF via Print Wizard and emails the generated PDF file using whatever the default email settings are:
!pdf /finv12.pdf /n"Your invoice |Thank you." /j"Your invoice" /firstname.lastname@example.org
You owe $1000.00 for services rendered.
The last example here, emails an attachment only, and includes the data as the body text rather than as an attachment:
!email /email@example.com /aLetter.doc /aInvoice.doc /j"subject" /n
The attached letter and invoice are for your review.
Let me know what you think.
Additional examples can be found in various other documents discussing the use of Print Wizard's bang commands.
There are two different ways of using CDO. The first uses MAPI and the second uses
SMTP calls wrapping around MAPI calls. They both go through the Windows standard routines to send email. Print Wizard implements CDO SMTP since it already has implemented MAPI elsewhere, and there really would be no difference (just in the call names).
Print Wizard CDO will take all files as attachments and email them over whatever default network protocol (usually TCP) that Windows recognizes. With this method you only need the Server name as the default port is set to the standard mail network port and authorization is assumed as anonymous.
- With anonymous and CDO, Outlook does not need to run to send email
- Email attachments may come back with "raw format" on some email readers
- Protocol failure occurs if a) “To” address is badly formatted or b) “From” address is badly formatted. This may include errors as a result of reverse DNS (domain name) lookups.
- Both Symantec and McAfee Internet Security (and especially the anti-virus portion) may see all attachments as viruses and you may have to "Yes" through several dialogs.
- Certain Internet Security Suites, such as Symantec and McAfee may return an error if it cannot resolve the “To” and “From” address through DNS and reverse DNS lookups.
MAPI is the standard set of calls used by Outlook, Outlook Express, Exchange and others. There are several levels of MAPI including Simple, Standard, Extended and Exchange Server versions.
Print Wizard implements basic MAPI calls which should work with Simple MAPI (Outlook Express), Standard and Extended.
Print Wizard MAPI sends all files as attachments. It also requires a specific Outlook Profile depending on the "transport" application. The default transport application is set
In the Windows Control Panel : Internet Options : Programs : E-Mail field. Default Profiles (not to be confused with Print Wizard print profiles) are set in the Control Panel : Mail : Show Profiles dialog. If you are using Outlook Express or Netscape Email, default settings for the profile are assumed and sometimes difficult to figure out (more on this later.)
When emailing via the MAPI protocol, you are dependent on 2 major items:
- Security software may prohibit or at least warn you before allowing a 3rd party program, such as Print Wizard, from sending email
- Outlook settings determine if and when the email gets sent. In typical setups, you have to bring up Outlook and tell it to Send/Receive before they actually leave the PC.
Other specifics about MAPI
- Profiles seem to be case-sensitive under certain circumstances
- Setting up a MAPI profile for faxing requires work
- Can't include leading or trailing spaces in attachment names (embedded are ok)
- Will not send if Outlook set to wait for user to do something ("Send/receive all") unlike Outlook which sends right away.
For those PCs with Outlook installed, Outlook allows 3rd party programs access through a series of COM object calls directly into Outlook. While this works more smoothly than MAPI, it may also be restricted by Security software and user permissions. The advantage is that in a typical Outlook setup, the email is sent out immediately by the COM objects without waiting for user intervention.
Like MAPI this will require an Outlook profile be already set up. This also does
not work if using Outlook Express or Netscape Mail.
Other specifics about Outlook
- Print Wizard may actually bypass asking for User Profile by doing a login session if allowed.
- While MAPI may wait for a user to force Send/Receive, this does not, it sends right away.
Print Wizard does have support for direct calls to a mail server over a network running simple Internet email. This is done through the SMTP setting where you do need the server name, the port to relay through, and you may also need a user name and password for authentication. This is typically the same as you would see from a UNIX/Linux host, accessing mail over IPOP, POP2, POP3, IMAP or some variation of remote email.
SMTP is straightforward but may not work in all environments, i.e. Microsoft Exchange servers may require the client be a MAPI or Outlook client, and Domino Notes and others
may require their own variation of email, blocking SMTP relaying.
Also some personal firewalls may prevent SMTP from sending direct over port without adding Print Wizard to the "Acceptable Applications" list.
We currently provide support for Windows MAPI, CDO and Outlook, as well generic SMTP (Simple Mail Transport Protocol), for outbound emails. Beginning with Print Wizard 3.2.52, we also offer support for email servers requiring SSL or TLS.
In order to send email through "gmail" or other web-based email sites, usually requires configuring your account to allow POP and/or SMTP. By default, most of these servers have this option turned off. We will use "gmail" as our example, but most other servers of this type have similar options.
To set up "gmail" for POP (and SMTP, the outbound connection type for POP), you need to log into your account first. Once logged in, go to the "Settings" page (link is on the top right). Select the "Forwarding and POP/IMAP" tab and change your POP Download setting to "Enable POP for mail that arrives from now on".
While Print Wizard does not actually read any emails currently on the server (POP outbound from the server), it does require that the host allow inbound (outbound from the PC) SMTP which is part of the POP protocol for forwarding and relaying emails.
Similar settings can be found for other email web-based sites such as Comcast, Juno, AOL, etc. If in doubt, ask the technical support for your email host vendor on "how to set up POP or SMTP relaying for a Windows email clients".
Email setup is done through the Print Wizard user interface. Select "Setup email" under the "Tools" menu.
When doing a setup involving SMTP, you can select "Authorization Required" and select "Use SSL/TLS" as the secure transport mechanism for SMTP emails.
Note: In order to provide the appropriate security for SSL and TLS, this option does require that two additional security libraries be installed. If these two files are not present, then this option will be disabled.
Installation of support files
There are two SSL DLL support files necessary for the Print Wizard program to use SSL for email. These two files, due to export restrictions, cannot be shipped in the installer, but can be downloaded separately from the Internet.
The two file are "ssleay32.dll" and "libeay32.dll" and are shipped as part of the OpenSSL license. However, we utilize some third party add-ons to this and not the standard OpenSSL dll libraries at this time. You can download these two files from one of the links below - be sure to drop both files into the same directory that Print Wizard is installed in.
Intelicom SSL (for Indy code) - click on the indy_openssl096g.zip
Note: The two files "ssleay32.dll" and "libeay32.dll" must exist in the same directory as printwiz.exe and pwui.exe resides in for the above mentioned SSL/TLS feature to be enabled.
There are various versions of these two libraries under the same name. At present, we utilize a version that supports specific third-party calls and hence it is necessary to use the two we have provided links for rather than others that may be installed currently on your Windows PC.
By placing these files in the same directory as the executable, they should not conflict with other versions installed on your PC. If you do run into problems, try restarting your PC and see if that clears up the problem.
==== Outlook as default - force Outlook SendMail dialog ====
printwiz /firstname.lastname@example.org "/jmy subject line" "/nline 1|line 2|line 3" /confirm
printwiz /email testfile
printwiz /email@example.com "/jmy subject line" "/nMessage body line 1|line 2|line 3" /confirm testfile testfile-bee /ac:\temp\mypdf.pdf "/ac:\temp\my tif file.tif"
printwiz /firstname.lastname@example.org "/jmy subject line" "/nMessage body line 1|line 2|line 3" /confirm testfile testfile-bee /ac:\temp\mypdf.pdf "/ac:\temp\my tif file.tif" /email@example.com,firstname.lastname@example.org /email@example.com,firstname.lastname@example.org
==== Outlook as default - automated ====
printwiz /email@example.com "/jmy subject line" "/nline 1|line 2|line 3"
printwiz /firstname.lastname@example.org "/jmy subject line" "/nMessage body line 1|line 2|line 3" /confirm testfile testfile-bee /ac:\temp\mypdf.pdf "/ac:\temp\my tif file.tif" /email@example.com,firstname.lastname@example.org /email@example.com,firstname.lastname@example.org
==== BANG command with Outlook ====
!email /email@example.com /ac:\temp\mypdf.pdf
This ends up as two attachments (this text and lines below are attached with a made-up filename, the attachment as the other)
!email /firstname.lastname@example.org /ac:\temp\mypdf.pdf /i
inline data can be in the body of email message
and line 4
This all ends up as the body
!email /email@example.com /ac:\temp\mypdf.pdf /j"no data to process, just an attachment"
!email /firstname.lastname@example.org /j"3rd em with no attch and no data" /n"3rd email with no attachment, just a body|second line of 3rd em"
!pdf /email@example.com /fc:\temp\mypdf.pdf /j"no body, data is made into a PDF and attached to email"
This is body of a pdf test.
Line 2 of body, skipping down a few lines
=== BANG inside a file with PCL ====
=== Note that for this to work, a profile needs to be specified and the PCLBANG option set to 1 (true)
<...lines of PCL initialization...>
The various components of an email can come from various sources and some are dependent on your email server as we will pass on certain information to the server for processing. Here are some general rules/examples for various parameters (based on command line parameters and BANG parameters that Print Wizard can accept). Note that most of these are optional and are not required. At the least, you can get by with
/email (if Print Wizard is not running quiet)
/firstname.lastname@example.org (if Print Wizard is running quiet)
Command line parameters
This sets the recipient address to send file(s) to. If you are doing a list of recipients, separate them by commas. Many email servers will process outbound email recipients with names as well (but not all), include these in quotes and bracket the actual email address. Here are some examples:
/email This will actually cause the email form to come up if not running quiet
/email="Jane Doe <email@example.com>,John Doe <firstname.lastname@example.org>"
Sets the blind carbon copy, BCC, addressing for an email. This follows the same rules for /EMAIL formats.
/EMAILCC=<address> Sets the CC field of the email
Sets the carbon copy, CC, addressing for an email. This follows the same rules for /EMAIL formats.
Set email type to CDO
Sets the recipient addressing for an email. The "toaddress" follows the same formatting rules as /EMAIL=<>.
This is the sender's email name. The format is free form but should be enclosed in quotes if there are any spaces.
The sender's address as a single email address.
/EMAILHTML=ON / OFF
Turn on/off sending the email message body as HTML.
Set email type to MAPI.
Email with MAPI. The "toaddress" follows the same formatting rules as /EMAIL=<>.
Set email type to Outlook
Email with Outlook. The "toaddress" follows the same formatting rules as /EMAIL=<>.
Mail server login password
Mail server port number for your SMTP server.
The Outlook/Exchange profile (MAPI only)
This is the mail server name. It should match the outgoing mail server for your site.
Set email type to SMTP
Email with SMTP. The "toaddress" follows the same formatting rules as /EMAIL=<>.
Mail server login name EmailToName
/CONFIRM=ON / OFF
If ON, this will force the email dialog to appear for MAPI, SMTP and CDO type emails. If your email type is Outlook, the Outlook email dialog should show. This does not work if Print Wizard is run in quiet mode, such as from a Windows Service.
This is the email "subject" line that will appear on the email. If there are embedded spaces, enclose this in quotes.
/j"My subject line"
This contains the notes for emailing (body). There are several different formats for the NOTES.
If the NOTES contains a file name, the file will be inserted in the body of the email.
If HTML is turned on, the NOTES can contain HTML type tags, such as <BR> for a line break.
If HTML is turned off, the NOTES are sent a standard text and do not have formatting. However, you can include a vertical bar, |, to represent a carriage return.
/n"<h3>Welcome</h3><p>This is a new message<br>with three lines</p>
/n"My notes line 1|Line 2|Line 3"
If a /n<notes> is used with a bang command, there is one additional feature here that is worth mentioning. If the last two characters before the line feed is the "/n", the data that follows the bang command will be carried directly in the message body of the email, not translated into an attachment. This allows for data to appear in the body from an application.
!email /email@example.com /j"my subject" /n
My message body line 1
My Message body line 2
The to message text string for faxing and emailing. For email, this follows the same formatting rules as the /EMAIL=<>.
We continue to develop and expand our email capabilities. As Windows Vista and and email security evolve, additional features and functionality will continue to be added. Here are a few examples already in the mix for future releases:
- Interaction with POP servers and sending through POP
- Direct support for Exchange
- A direct solution to replace the need for "ssleay32.dll" and "libeay32.dll"
- Better Outlook support
- Emailing with fax capabilities for eFax and other online fax services
As with everything, we do provide a reasonable amount of free technical support. If you have problems or questions, you can always call us.
- As needs arise, we continue to develop email solutions for various email servers. If you have a need we have not covered, please let us know.
- We continue to support various security means for emailing. Microsoft and other vendors continue to tighten down unwanted emailing and we continue to try to work to stay current. If you run into something, we would like to know about it.
Visual Basic Script and other Windows scripting languages, as well as Visual C, Visual Basic and Visual Basic for Applications, all support CDO COM object calls. These can be a handy way of testing to see if CDO is actually supported by your PC.
NOTE: In many respects, CDO as can be the most reliable of the various email protocols for Windows. The small Visual Basic Script below can help determine if CDO actually works in your environment.
Copy the following lines into a notepad file, edit the email information and save the file, or rename it, with a ".vbs" extension. You can then run the file from a command prompt (CMD) and if there are any errors, most likely CDO is not fully functional on this PC.
const cdoSendUsingPort = 2
const cdoAnonymous = 0
set msg = CreateObject("CDO.Message")
set config = CreateObject("CDO.COnfiguration")
set msg.Configuration = config
.to = "firstname.lastname@example.org"
.from = "someonesPC@somewhere.com"
.subject = "CDO Test message from vbscript with no attachments"
.textbody = "This is the text body with two lines" & vbCRLF & "and this is line two"
prefix = "http://schemas.microsoft.com/cdo/configuration/"
.item(prefix & "sendusing") = cdoSendUsingPort
.item(prefix & "smtpserver") = "mail.somewhere.com"
.item(prefix & "smtpauthenticate") = cdoAnonymous
on error resume next
send_errono = err.number
on error goto 0
if send_errno <> 0 then
wscript.echo "Error sending message"
wscript.echo "Message sent"
A typical CDO script assumes smtp for MAPI and CDO is installed on the computer.
If local SMTP support is not available, then a work around is needed. To do this, the script sends the email to a specific server, as the script above does. But it also assumes anonymous is allowed (not restricted to a login just to send outbound emails).
If the email server requires a log in just to send email, then user and password need to be added to the configuration record. Check out the page
To fit this into the example provided above, add two lines:
.item(prefix & "sendusername") = "username"
.item(prefix & "sendpassword") = "password"
These will replace the line "...smtpauthenticate") = cdoAnonymous".
Of course this whole thing still depends on a host somewhere on your network that will accept smtp. If there is no such host, then you have a problem. Even with outsourced email, many ISPs, but not all, will accept SMTP if authenticated properly (just not anonymously).
Additional information on CDO and MAPI can be found on the following web documents: