Send email automatically

Is there a way to auto-populate the email recipients and auto-send the email without prompting when using the auto-save feature.

Hi,

 

this is only possible by using a customized script, not with the built in features.

 

regards,

 

Robin

Hi,

Many thanks for the fast response.

Is there a possibility that you can please provide me with a simple script that I can use as a base to start customising so that I can implement the desired feature.

Many thanks in advance

Regards

Elvis

 Hello,

this would be an interesting functionality for us, too...

any example would be great...

 

Thank you in advance

 

Jochen

Hello,

you can use this vbs to send mails as "Action after saving". You will need blat.exe, which is a very small and versatile command line mail client.

This script will be included in the next release as well.

kind regards,
Philip

' SendMail script
' Part of PDFCreator
' License: GPLv3
' Homepage: http://www.pdfforge.org/
' Windows Scripting Host version: 5.1
' Version: 1.0.0.0
' Date: May 23, 2012
' Author: Philip Chinery
' Comments: This script sends a mail using blat
'           The script requires blat.exe
'          
http://www.blat.net/

Dim cmdline, subject, receipient, sender, server, user, password, bodyFile, blat, additionalParams, file

' Please configure this section to suit your needs

' Receipient's E-Mail address
receipient = "admin@localhost"

' Your E-Mail address
sender = "admin@localhost"

' Subject for the mail
subject = "A new file was converted"

' Server name or IP address
server = "localhost"

' user name - leave empty if none required
user = ""

' password  - leave empty if none required
password = ""

' a text file containing the mail body text
bodyFile = "mailbody.txt"

' Path to blat.exe (including blat.exe)
blat = "C:\\Blat\\blat.exe"

' Add other blat params here, if required. i.e. you can use " -log C:\\blat-log.txt" for logging
additionalParams = "-log C:\\blat-log.txt"

' the actual scripts starts here

Set Wshshell = CreateObject("wscript.shell")

Set objArgs = WScript.Arguments

If objArgs.Count = 0 Then
 MsgBox "This script needs a parameter!", vbExclamation, AppTitle
 WScript.Quit
End If

if bodyFile = "" then
  MsgBox "The body file is not defined. Please configure this script first!"
  WScript.Quit
end if

file = objArgs(0)

cmdline = """" & blat & """ """ & bodyFile & """ -t " & receipient & " -server " & server & " -f " & sender & " -s """ & subject & """ " & additionalParams & " -attach """ & file & """"

if user <> "" then
  cmdline = cmdline & " -u " & user
end if

if password <> "" then
  cmdline = cmdline & " -pw " & password
end if

wshshell.Run cmdline, 1, True

 Thanks for this script. I have another question. Is it possible to automatically recognize the username or mailaddress which prints the pdf and fill this to blat.exe to send to the author.

For example - you use this for more users and have active directory. so it could be good to automatically get the mailadress and transfer to this.

We need this dynamically not only to one mail adress.

thanks for help

 

stefan

Hi,

 

it is possible to parse parameters (including all tokens) on to the script, you will need to customize it though.

 

regards,

 

Robin

 Hi, I too am looking for a product with the ability to print-to-pdf-and-email without any input.  

Basicly, I have a bunch of servers that print out a ream of paper reports per day (each), that I would MUCH prefer be emailed to me.

*  When is the "new version" with this feature scheduled to be available?

*  Does anyone know of any other product, commercial or otherwise, that can do this now?

I've had this working with a vbs script since version 1.2.3.  I just updated to 1.4.2 last night and the same script works, I just had to adjust the variables within the PDFCreator Options.  We are still in the testing/limited use of this on our 2008 R2 print server, but it seems to run great and assuming we expand our usage we'll definately donate to this great yet simple program.

Here is the script, in which you modify with your smtp server IP and email domain. (I found this posted somewhere else, so I don't claim to be a vbs expert):

 

 

Option Explicit

Const AppTitle = "PDFCreator - EmailToUser"

Dim objArgs, filelocation, filename, user, server, objMessage

Set objArgs = WScript.Arguments

If objArgs.Count = 0 Then
MsgBox "This script needs a parameter!", vbExclamation, AppTitle
WScript.Quit
End If

filelocation = objArgs(0)
filename = objArgs(1)
user = objArgs(2)

' create message object
Set objMessage = CreateObject("CDO.Message")

' assign smtp server variable
server = "xxx.xxx.xxx.xxx"

' configure to use smtp server
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

' set smtp server name
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = server

' set smtp port
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

objMessage.MIMEFormatted = False
objMessage.Subject = "PDFCreator - " & filename
objMessage.From = "doNotReply@yourcompanyname.com"
objMessage.To = user & "@yourcompanyname.com"
objMessage.AddAttachment filelocation

 

objMessage.Send

Now the information above is just the vbs script.  To get the PDFCreator up and running on the server follow the following steps.  Hopefully this saves you some time, as I spent several days getting this to work the 1st time I tried.

1)      Install PDFCreator (Choose Expert Mode since it is a server) on print server, set printer name.

2)      Delete PDFCreator from Startup (we'll set it to start as a sevice so you don't have to remain logged in for it to run)

3)      After install, go to list of printers and share the PDFCreator printer.

4)      Open PDFCreator (as admin on 2008), click on Printer->Options.

5)      Set Auto-Save screen as follows. (you can select different filenames or directories)

                    a) check "Use Auto-save" checkbox

                    b) Autosave format = PDF

                    b) Filename =

                    c) check the "use this directory for auto-save" and enter C:\\PDF\\

6)       Set Actions screen as follows, and save.

                  a) check the "action after saving" checkbox

                  b) select the vbs script that you have saved to the print server from earlier as the "Program/Script"

                  c) set the "Program Parameters" as """"""

                                 Make sure the program parameters are exactly as above!  Including quotes.

                  d) I've set the window style to "Hide" and checked the "wait until the program/script is ready"

7)  NOTE: in some version of PDFCreator there is a bug with the parameter, where it uses the username that runs the PDFCreator.exe rather than the user who has sent the print job (not sure about 1.4.2), but to be safe make sure that the “Use Standard Author” is UNCHECKED (under the Options>Program>Document tab).

 

8) Setup PDFCreator to run as a service, so that users don’t need to be logged in for the program to run.

a)  On the print server download "reskit" to C:\\.  If you just google "download reskit", you should find it.

b)      Run cmd (as Admin) -  “C:\\reskit\\instsrv.exe “PDFCreator” c:\\reskit\\srvany.exe”

        This creates a "PDFCreator" service, but you can call it something different if you like.

c)       Open Regedit and browse to HKLM\\SYSTEM\\CurrentControlSet\\Services\\PDFCreator

d)    Add Key and call it Parameters.  Add String Value, call it “Application” and enter the path to the PDFCreator.exe (C:\\Program Files (x86)\\PDFCreator\\PDFCreator.exe)

e)  Start the service, you may have to check on what user you are running with and set permissions accordingly.  the SYSTEM account should work.

 

 

A couple last comments.

You'll want to setup some kind a scheduled task to clean up the c:\\pdf folder or wherever you dump the pdf's before they email out.  I run a task every night.

 

I've set the [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\PDFCreator\\Program] to "UpdateInterval" = "0".  So that it doesn't try to auto update.

 Hi,

i tried this script under a win 7 PC and it seems like the Filename will not be send correct. I always get an vb exeption at that line were the Filename is located. This happes even if i set an filename like test.pdf.

When i use commandshell to start the script it works fine. Did i miss something or where there any changes in the latest Version.

 

regards

cornulio

Hi everybody, 
i get this error messaged on the log , any clue ??


2012.10.06 20:15:50 (Sat)------------Start of Session-----------------
Blat v3.0.7 (build : Jul 20 2012 01:24:19)
32-bit Windows, Full, Unicode
Sending C:\\blat\\mailbody.txt to xxx@gmail.com
Subject: Rapport
Login name is XXXX@gmail.com
Attached binary file: D:\\Rapport\\blat-log - Notisblokk.pdf
*** Error ***  The SMTP server does not like the sender name.
*** Error ***  Have you set your mail address correctly?
2012.10.06 20:16:05 (Sat)-------------End of Session------------------