dbTalk Databases Forums  

PDF and EMAIL

comp.databases.pick comp.databases.pick


Discuss PDF and EMAIL in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
john@mrpsystems.co.uk
 
Posts: n/a

Default PDF and EMAIL - 06-22-2005 , 06:34 AM






Hello

I have seen some differing subjects (within the group) on this matter,
but nothing that seems to provide me with exactly what I am looking
for, or maybe I am not understanding the issue correctly in the 1st
place.

I have procedures in place to produce any PDF document required from
within D3. I currenty use "txt2PDF" from Sanface. This all works very
well on Linux. Generasting standard reports etc is no problem.

I now need to take this a step further and start to SEND these out via
email, from the Linux Server (primarily RedHat 9.0 and RedHat
Enterprise 3.0). I am quite happy with the actual syntax and
operational side of "sendmail" and "postfix". Sending "text" documents
is a breeze.

However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL / PDF
file genration before using "sendmail" etc.

Regards

John


Reply With Quote
  #2  
Old   
jra
 
Posts: n/a

Default Re: PDF and EMAIL - 06-22-2005 , 06:26 PM






This is a Basic Program that sends PDFs attachments with sendmail (Red
Hat 7.1)

You need a Base64 encoder for Linux, i do not know if Red Hat 9 or
Enterprise has it.

I use one opensource software. Look in Google for a file named:

MIME-Base64-3.05.tar

Install it and change the basic instruction:

"EXECUTE "!/base/ibase64 ":PDFPATH CAPTURING OUTPUT"

to your directory.

Hope this help

joseba real de asua
frelance (AT) sarenet (DOT) es


BASIC PROGRAM
*--------------------------------------------------------------------------------------------


PDFPATH = "/tmp/kalis.pdf"
NAME = "kalis.pdf"
PDF="kalis"
PDFNAME = NAME

*---------------------------------------------------
* codificar el documento PDF como BASE 64
*---------------------------------------------------
EXECUTE "!/base/ibase64 ":PDFPATH CAPTURING OUTPUT


PDFOUTPUT = OUTPUT

*-----------------------------------------------------------------------------------------------------
*
* Crear la cabecera del MAIL
*
*-----------------------------------------------------------------------------------------------------

Mensaje=''
Mensaje1=''
Mensaje1=Mensaje1: "Date: ":OCONV(DATE(),"D4"):"
":OCONV(TIME(),'MT'):CHAR(13):CHAR(10)
FROM = "origen (AT) dominio (DOT) com"
ORG = "Nombre"
SUBJECT = "PDF como anexo"
TOMAIL="a (AT) direccion (DOT) com"
CCMAIL="copia_a (AT) direccion (DOT) com"
Mensaje1=Mensaje1: "From:":FROM:CHAR(13):CHAR(10)
Mensaje1=Mensaje1: "Organizacion:":ORG:CHAR(13):CHAR(10)
Mensaje1=Mensaje1: "MIME-Version: 1.0":CHAR(13):CHAR(10)
Mensaje1=Mensaje1:"To:":TOMAIL:CHAR(13):CHAR(10)
Mensaje1=Mensaje1:"Cc: ":CCMAIL:CHAR(13):CHAR(10)
Mensaje1=Mensaje1: "Subject:":SUBJECT:CHAR(13):CHAR(10)

*---------------------------------------------------------------------------------------------------
*
* Marcar la parte MIME
*
*---------------------------------------------------------------------------------------------------

BOUNDARY="---------All-Spec-Boundary"

*---------------------------------------------------------------------------------------------------
*crear el e-mail como multipart/mixed para incluir el anexado
*---------------------------------------------------------------------------------------------------
Mensaje1=Mensaje1: "Content-type: multipart/mixed; "
Mensaje1=Mensaje1: 'boundary="':BOUNDARY:'";':CHAR(13):CHAR(10)
BOUNDARY="--":BOUNDARY


Mensaje=Mensaje1:CHAR(13):CHAR(10)

*---------------------------------------------------------------------------------------------------
* Marca Uno
*---------------------------------------------------------------------------------------------------

Mensaje=Mensaje:BOUNDARY:CHAR(13):CHAR(10)

Mensaje=Mensaje: "Content-Type: text/plain;
charset=us-ascii":CHAR(13):CHAR(10)
Mensaje=Mensaje: "Content-Transfer-Encoding: 7bit":CHAR(13):CHAR(10)
Mensaje=Mensaje:CHAR(13):CHAR(10)
TEXTMensaje="Prueba PDF"
Mensaje=Mensaje:TEXTMensaje:CHAR(13):CHAR(10)
Mensaje=Mensaje:CHAR(13):CHAR(10)

Mensaje=Mensaje:BOUNDARY:CHAR(13):CHAR(10)

*----------------------------------------------------------------------------------------------------
* Fin de la marca
*----------------------------------------------------------------------------------------------------

*----------------------------------------------------------------------------------------------------
*
* Especificar el tipo MIME como application/pdf ya que el anexado es un
documento PDF codificado en base64
*
*----------------------------------------------------------------------------------------------------
Mensaje=Mensaje:'Content-Type: application/pdf;

*----------------------------------------------------------------------------------------------------
*
* Nombrar la marca
*
*----------------------------------------------------------------------------------------------------
Mensaje=Mensaje:'name="':PDFNAME:'"':char(13):char (10)

*----------------------------------------------------------------------------------------------------


*----------------------------------------------------------------------------------------------------
* Decirle al cliente de e-mail que esta recibiendo datos codificados en
base64
*----------------------------------------------------------------------------------------------------


Mensaje=Mensaje:'Content-Transfer-Encoding: base64':CHAR(13):CHAR(10)

*----------------------------------------------------------------------------------------------------
* Decirle al cliente de e-mail que presente los datos como anexado
*----------------------------------------------------------------------------------------------------
Mensaje=Mensaje:'Content-Disposition: attachment; '


*----------------------------------------------------------------------------------------------------
* Nombrar el anexado
*----------------------------------------------------------------------------------------------------
Mensaje=Mensaje:'filename="':PDFNAME:'"':char(13): char(10)
Mensaje=Mensaje:CHAR(13):CHAR(10)


*----------------------------------------------------------------------------------------------------
* Aņadir el PDF codificado en base64
*----------------------------------------------------------------------------------------------------
Mensaje=Mensaje:PDFOUTPUT:CHAR(13):CHAR(10)
Mensaje=Mensaje:CHAR(13):CHAR(10)


*-----------------------------------------------------------------------------------------------------
* Cerrar la parte MIME con 2 guiones al final a la derecha
*-----------------------------------------------------------------------------------------------------
Mensaje=Mensaje:BOUNDARY:"--":CHAR(13):CHAR(10)


*-----------------------------------------------------------------------------------------------------
* Mensaje MIME terminado
*-----------------------------------------------------------------------------------------------------


*-----------------------------------------------------------------------------------------------------
* Escribir el MIME en un directorio de Linux
*-----------------------------------------------------------------------------------------------------
open "unix:/tmp" to PDFTEMP
WRITE Mensaje ON PDFTEMP, PDF:".mail_pdf"
PATHTOMensaje = "/tmp/":PDF:'.mail_pdf'

*-----------------------------------------------------------------------------------------------------
* Enviarlo con SENDMAIL
*-----------------------------------------------------------------------------------------------------
EXECUTE '!/usr/sbin/sendmail -t -Rfull -fdireccion (AT) dominio (DOT) com <
':PATHTOMensaje CAPTURING OUTPUT RETURNING OUTPUT2

*-----------------------------------------------------------------------------------------------------
* Borrar el MIME
*-----------------------------------------------------------------------------------------------------
EXECUTE '!rm -f /tmp/':-pDF:"*"
*---------------------------------------------------------------------------------------------------------------


Reply With Quote
  #3  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: PDF and EMAIL - 06-22-2005 , 07:04 PM



Solution 1:

From the sendmail FAQ:
Q: How do I create attachments with sendmail?
A: You don't. Sendmail is a mail transfer agent (MTA). Creating e-mail
messages, including adding attachments or signatures, is the function
of a mail user agent (MUA). Some popular MUAs include mutt, elm, exmh,
Netscape, Eudora and Pine. Some specialized packages (metamail, some
Perl modules, etc.) can also be used to create messages with
attachments.

Solution 2:
http://www.google.com/search?hl=en&q...il+attachments
That link brings you to the info above as well as:
http://home.clara.net/dwotton/unix/mail_files.htm
See BASH script from that page.
Beyond that, happy hunting. You'll see the solution is to convert the
attachments into Base64 and embed them in the mail as text.

Solution 3:

Have a look a the code sample for NebulaMail at this URL (some
assembly of the anti-spam URL required):

http://
removethisNebula-RnD
..com/products/mail.htm

The reason why I wrote NebulaMail is to save you guys from going
through all of the pain that's evident every time this request comes
up here in CDP. There's no need to mess with MIME types, MAPI,
sendmail, blat, SMTP, or any related protocols or programs. Sending
attachments with NebulaMail is as easy as setting a variable with the
path/filenames.

Extra notes:
- That web page above is old but mostly accurate, please contact me
for current info. For example, calling NEBULA.GET.MIME.TYPE is now
optional. I need time to update the page.
- The downloadable PDF User Guide is older as well but a good rough
guide. Please request a current doc if interested.
- NebulaMail is available for only $249US per server and is currently
only available for D3. The exact same code runs over Win32 and *nix.
Ports for other platforms have been done but not updated for lack of
demand - but I'm open for discussion.
- NebulaMail comes with a Lot of free functional sample code,
extensive docs for usage and troubleshooting, free installation
assistance, and free support. I can afford free support because the
code is stable and a change to the code hasn't been necessary in a
Long time. Some update/enhancements are in testing however, and
updates are free to our clients.

Solution 4:
Check with Ross at Stamina.


Tony
TG@
removethisNebula-RnD
..com






john (AT) mrpsystems (DOT) co.uk wrote:

Quote:
Hello

I have seen some differing subjects (within the group) on this matter,
but nothing that seems to provide me with exactly what I am looking
for, or maybe I am not understanding the issue correctly in the 1st
place.

I have procedures in place to produce any PDF document required from
within D3. I currenty use "txt2PDF" from Sanface. This all works very
well on Linux. Generasting standard reports etc is no problem.

I now need to take this a step further and start to SEND these out via
email, from the Linux Server (primarily RedHat 9.0 and RedHat
Enterprise 3.0). I am quite happy with the actual syntax and
operational side of "sendmail" and "postfix". Sending "text" documents
is a breeze.

However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL / PDF
file genration before using "sendmail" etc.

Regards

John


Reply With Quote
  #4  
Old   
Ross Ferris
 
Posts: n/a

Default Re: PDF and EMAIL - 06-22-2005 , 07:47 PM



Thanks for the plug Tony :-)))

Visage.Emailer would certainly fit the bill, and when combined with
Visage.Reporter would even provide a powerful forms designer that can
generate PDF's, or just send to ANY printer, or use Visage.Faxer to fax
out.

(Emailer & Faxer can handle in & outbound traffic, allowing you to
direct incoming faxes to people via email, or have a Basic program
intelligently respond to an incoming email, or fax a text or HTML file
generate from Basic etc etc etc)

However, like our MailLynx product (free trial available for download
with documentation from www.stamina.com.au ), these would require the
presence of at least a Windows 2000 Pro machine (or more realistically
an XP machine these days) -hopefully not a biggie, but ....

Ross Ferris
Stamina Software
Visage - a complete solution to the application puzzle !


Reply With Quote
  #5  
Old   
Scott Ballinger
 
Posts: n/a

Default Re: PDF and EMAIL - 06-22-2005 , 10:33 PM



There is a command line mailer available for dos & linux called postie
that does attachments no problem- http://www.infradig.com/

Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006

john (AT) mrpsystems (DOT) co.uk wrote:
Quote:
Hello

I have seen some differing subjects (within the group) on this matter,
but nothing that seems to provide me with exactly what I am looking
for, or maybe I am not understanding the issue correctly in the 1st
place.

I have procedures in place to produce any PDF document required from
within D3. I currenty use "txt2PDF" from Sanface. This all works very
well on Linux. Generasting standard reports etc is no problem.

I now need to take this a step further and start to SEND these out via
email, from the Linux Server (primarily RedHat 9.0 and RedHat
Enterprise 3.0). I am quite happy with the actual syntax and
operational side of "sendmail" and "postfix". Sending "text" documents
is a breeze.

However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL / PDF
file genration before using "sendmail" etc.

Regards

John


Reply With Quote
  #6  
Old   
Glen
 
Posts: n/a

Default Re: PDF and EMAIL - 06-22-2005 , 10:49 PM



On 22 Jun 2005 04:34:56 -0700, john (AT) mrpsystems (DOT) co.uk wrote:

Base64 encode the PDF document and then use MIME envelopes. There are
plenty of free base64 command line tools available. If you get one
make sure it will return the encoded data back to standard out for
'CAPTURING'.

Mime is very easy to use once you understand how boundaries and
content directives work. Note the dashes that are added before and
after the boundary name. These define the sections of the envelope and
also where the envelope stops. The boundary is defined in the header
with the header content-type. The header content-type will always be
multipart/mixed if you are sending more than one kind of data in a
single e-mail.

EMAIL is the e-mail address who is sending the e-mail. Anything in < >
means to fill in corresponding data. I use concatenation to assign all
the e-mail strings into one variable and then write it to a local disk
file via Q-pointer. Then, I call sendmail

EMAIL="myemail (AT) myhost (DOT) com"
ORG="MY COMPANY"
SUBJECT="TESTING ATTACHMENTS"
TOMAIL="someonesemail (AT) host (DOT) com"

EXECUTE '!base64 /tmp/email.pdf' CAPTURING PDFDATA

MSG=''
MSG=MSG:"Date: ":OCONV(DATE(),'D4'):CHAR(13):CHAR(10)
MSG=MSG:"From: ":EMAIL:CHAR(13):CHAR(10)
MSG=MSG:"Organization: ":ORG:CHAR(13):CHAR(10)
MSG=MSG:"To: ":TOMAIL:CHAR(13):CHAR(10)
MSG=MSG:"Subject: ":SUBJECT:CHAR(13):CHAR(10)
MSG=MSG:"MIME-Version: 1.0":CHAR(13):CHAR(10)
MSG=MSG:"Content-type: multipart/mixed;"
MSG=MSG:'boundary="unique-boundary";':CHAR(13):CHAR(10)
MSG=MSG:CHAR(13):CHAR(10)
MSG=MSG:"--unique-boundary":CHAR(13):CHAR(10)
MSG=MSG:"Content-type: text/plain; charset=us-ascii":CHAR(13):CHAR(10)
MSG=MSG:"Content-transfer-encoding: 7bit":CHAR(13):CHAR(10)
MSG=MSG:"Content-disposition: inline":CHAR(13):CHAR(10)
MSG=MSG:CHAR(13):CHAR(10)
MSG=MSG:"this is the text section of the mime envelope and it will be
displayed as a normal e-mail message.":CHAR(13):CHAR(10)
MSG=MSG:CHAR(13):CHAR(10)
MSG=MSG:"--unique-boundary":CHAR(13):CHAR(10)
MSG=MSG:"Content-type: application/pdf;"
MSG=MSG:"name=<name of attachment>":CHAR(13):CHAR(10)
MSG=MSG:"Content-transfer-encoding: base64":CHAR(13):CHAR(10)
MSG=MSG:"Content-disposition: attachment;"
MSG=MSG:"filename=<filename of attachment file>":CHAR(13):CHAR(10)
MSG=MSG:CHAR(13):CHAR(10)
MSG=MSG:PDFDATA:CHAR(13):CHAR(10)
MSG=MSG:CHAR(13):CHAR(10)
MSG=MSG:"--unique-boundary--":CHAR(13):CHAR(10)

WRITE MSG ON TMP.F, FILENAME:".email"
PATHTOMSG = "/tmp/":FILENAME:".email"

EXECUTE '!sendmail -f ':EMAIL:' -r ':EMAIL:' -t -Rfull < ':PATHTOMSG
CAPTURING OUTPUT RETURNING OUTPUT2


Glen
http://mvdevcentral.com
http://picksource.com

Quote:
Hello

I have seen some differing subjects (within the group) on this matter,
but nothing that seems to provide me with exactly what I am looking
for, or maybe I am not understanding the issue correctly in the 1st
place.

I have procedures in place to produce any PDF document required from
within D3. I currenty use "txt2PDF" from Sanface. This all works very
well on Linux. Generasting standard reports etc is no problem.

I now need to take this a step further and start to SEND these out via
email, from the Linux Server (primarily RedHat 9.0 and RedHat
Enterprise 3.0). I am quite happy with the actual syntax and
operational side of "sendmail" and "postfix". Sending "text" documents
is a breeze.

However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL / PDF
file genration before using "sendmail" etc.

Regards

John


Reply With Quote
  #7  
Old   
Peter McMurray
 
Posts: n/a

Default Re: PDF and EMAIL - 06-23-2005 , 03:25 AM



Hi
I can recommend Postie as being very easy to interface back in 1999. I
reckon it could only have got better.
Peter McMurray
"Scott Ballinger" <scott (AT) paretoTIRED-OF-SPAM (DOT) net> wrote

Quote:
There is a command line mailer available for dos & linux called postie
that does attachments no problem- http://www.infradig.com/

Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006

john (AT) mrpsystems (DOT) co.uk wrote:
Hello

I have seen some differing subjects (within the group) on this matter,
but nothing that seems to provide me with exactly what I am looking
for, or maybe I am not understanding the issue correctly in the 1st
place.

I have procedures in place to produce any PDF document required from
within D3. I currenty use "txt2PDF" from Sanface. This all works very
well on Linux. Generasting standard reports etc is no problem.

I now need to take this a step further and start to SEND these out via
email, from the Linux Server (primarily RedHat 9.0 and RedHat
Enterprise 3.0). I am quite happy with the actual syntax and
operational side of "sendmail" and "postfix". Sending "text" documents
is a breeze.

However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL / PDF
file genration before using "sendmail" etc.

Regards

John




Reply With Quote
  #8  
Old   
Art Martz
 
Posts: n/a

Default Re: PDF and EMAIL - 06-28-2005 , 09:38 AM



Tony Gravagno wrote:
Quote:
Solution 1:

From the sendmail FAQ:
Q: How do I create attachments with sendmail?
A: You don't. Sendmail is a mail transfer agent (MTA). Creating e-mail
messages, including adding attachments or signatures, is the function
of a mail user agent (MUA). Some popular MUAs include mutt, elm, exmh,
I'll second using mutt. I use it to send PDF and FDF documents directly
out of our D3/aix system. mutt answered the question, "how do I send
attachments" very nicely.

Art


Reply With Quote
  #9  
Old   
Spent
 
Posts: n/a

Default Re: PDF and EMAIL - 07-07-2005 , 04:56 PM



john (AT) mrpsystems (DOT) co.uk wrote in news:1119440096.129763.316130
@g14g2000cwa.googlegroups.com:

Quote:
Hello

I have seen some differing subjects (within the group) on this matter,
but nothing that seems to provide me with exactly what I am looking
for, or maybe I am not understanding the issue correctly in the 1st
place.

I have procedures in place to produce any PDF document required from
within D3. I currenty use "txt2PDF" from Sanface. This all works very
well on Linux. Generasting standard reports etc is no problem.

I now need to take this a step further and start to SEND these out via
email, from the Linux Server (primarily RedHat 9.0 and RedHat
Enterprise 3.0). I am quite happy with the actual syntax and
operational side of "sendmail" and "postfix". Sending "text" documents
is a breeze.

However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL /
PDF
file genration before using "sendmail" etc.

Regards

John

John,

We do exactly what you are wanting to do and it is very easy. If you
send a binary file through Sendmail/Postfix etc. you will notice that
it gets sent as an attachment where a text file will end up as the body
of the email. We use uuencode to convert the pdf files into a binary
and then email the binary file. Uuencode is generally on a Linux
system's install disks, but often is not installed automatically. Check
/usr/bin and see if it is there first. Man pages should help you do the
rest.

Good Luck,
Scott


Reply With Quote
  #10  
Old   
Panama Red
 
Posts: n/a

Default Re: PDF and EMAIL - 07-18-2005 , 09:33 PM



I believe it was john (AT) mrpsystems (DOT) co.uk who said...
Quote:
However, sending PDF files, or any type of file in essence, requires
they be sent as "attachments". This is where I am stuck !!!

Can anyone guide me as to what I need to do in terms of the EMAIL / PDF
file genration before using "sendmail" etc.
It may be overkill, but you can look at mutt

--
-----------------------------------------------------------------------------
Usenet Poster
usenet (AT) gnubin (DOT) com
-----------------------------------------------------------------------------


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.