We help IT Professionals succeed at work.
Get Started
Troubleshooting Question

Using CURL to send multipart/alternative email WITH encoder=quoted-printable. How?

Last Modified: 2021-03-12
Below is an example of how I currently send a multipart/alternative with CURL. I write this email in a text editor, save it to a file and use CURL to send the whole thing.

To: "John Connor" <john@sky.net>
From: "Sarah Connor" <sarah@sky.net>
Subject: A multipart/alternative text/plain + text/html email
MIME-Version: 1.0 (Created with SublimeText 3)
Content-Type: multipart/alternative; boundary="content-boundary-alternative"

Preamble: This is a multipart/alternative message in MIME format.

Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

Good morning.

This is a message in text/plain format.

Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html lang=3D"en">
<meta charset=3D"utf-8">
<meta http-equiv=3D"Content-Type" content=3D"text/html">
Good morning.<br/>
This is a message in text/html format.<br/>

Then I send it like this:

curl --verbose -ssl smtps://secure.example.com:465 --login-options AUTH=PLAIN --user sarah@sky.net:Letmein#123 --mail-from sarah@sky.net --mail-rcpt john@sky.net --mail-rcpt-allowfails --upload-file complete-message.eml
So far so good.

While reading the CURL manpage, more specifically, https://curl.se/docs/manpage.html#-F I noticed there seems to be a way to properly encode the quoted-printable text/html content for transfer using -F, --form encoder=quoted-printable so that I don't have to do it manually.

Can anyone provide an adaptation of my approach that includes encoder=quoted-printable?

I have a feeling this calls for the headers and the bodies to be placed in separate files but I'm still reading.
Watch Question
This question hasn't been answered yet.
While you wait, find out how you can maximize your capability with the most trusted tool in IT.
Explore More Ask a Question
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE