Email options

Form2PDF includes an SMTP client which can be used for sending the resulting PDF documents (or in fact any file) as an email with document(s) being attachments. Example:

form2pdf –mailto user@example.com –sender sender@example.com test.txt test.pdf

Address formats

Addresses can be in one of two forms. First, the normal, address-only, “user@host.domain” notation, and second the “Full Name <user@host.domain>” notation. Either form can be used for both the –mailto, –cc, and –bcc options.

Subject and headers

You can specify the e-mail subject using the parameter “–subject”. Also it is possible to add other custom header lines by adding those to a separate file and then use the “–headerfile” parameter. Example:

form2pdf –mailto user@example.com –sender sender@example.com –subject “Invoice 12340” invoice.txt invoice.pdf

Multiple recipients

In order to send e-mail to multiple recipients Form2PDF supports use of one or more “–mailto” parameters and optionally use of “–cc” (carbon copy) and “–bcc” (blind carbon copy) parameters. Each recipient specified by the use of these parameters will receive a copy of the e-mail. In the e-mail headers there will be one corresponding To:, Cc: and Bcc line for each entry. Example:

form2pdf –sender sender@example.com –mailto user1@example.com –mailto user2@example.com –cc user3@example.com –cc user4@example.com –bcc user5@example.com –bcc user6@example.com mydocument.doc test.pdf

SMTP authentication

Some SMTP servers requires the client to authenticate before allowing e-mails to be sent. This is supported by Form2PDF via the “–smtpuser” and “–smtppassword” parameters. Authentication is only done if both the username and password is set.

If the server allows the LOGIN method, that is used. As a second choice, PLAIN is used. If neither method is supported, authentication isn’t used.

Example:form2pdf –mailto user@example.com –sender sender@example.com –smtphost smtp.example.com –smtpuser myuser1 –smtppassword secret test.txt test.pdf

Encryption (TLS/STARTTLS or SSL/smtps)

In order to connect to a SMTP server supporting TLS (STARTTLS) use parameter “–tls”. For SSL/smtps use “–smtps”.

Parameter “–mailonly”

When using the “–mailonly” parameter no conversion is performed and form2pdf acts as a stand-alone SMTP client which can be used to send any kinds of attachments (text, documents, images etc) as e-mail from the command-line. Example:

form2pdf –mailonly –mailto user@example.com –sender sender@example.com mydocument.doc

Parameter “–noinline”

By default, files ending with .txt, .gif, .jpg and .png are sent with the disposition parameter set to “inline”, and all others as “attachment”. To send all files as attachments, use the parameter –noinline.

Delivery receipts

To get a delivery receipt when the user has opened the mail, use the parameter “–receiptto”. Please note that not all e-mail clients support delivery receipts and if they do the user can usually suppress sending of the receipt. Example:

form2pdf –mailonly –mailto user@example.com –receiptto sender@example.com  –sender sender@example.com mydocument.doc