How can I add an attachment with Sendmail (limited options)?

user1392897

I am working with a locked-down RHEL box.

The goal is to send an email with a file attached.

The only mail service available is sendmail (cannnot use sendemail, mail, mailx, mutt, etc.)

In addition, the uuencode command cannot be found and I cannot install sharutils.

I have verified that sendmail works with the simple test below:

echo "Subject: testing" | sendmail -v [email protected]

I have tried the command below but it just creates a dead.letter:

echo "Subject: testing" | sendmail /a /tmp/test.txt [email protected]

What is the correct way to send a file from the server using sendmail given the constaints?

user1392897

The work-around was to use openssl base64 encoding like so:

( echo "to: [email protected]"
  echo "subject: Message from the server"
  echo "mime-version: 1.0"
  echo "content-type: multipart/related; boundary=messageBoundary"
  echo
  echo "--messageBoundary"
  echo "content-type: text/plain"
  echo
  echo "Please find the document attached."
  echo
  echo "--messageBoundary"
  echo "content-type: text; name=test.txt"
  echo "content-transfer-encoding: base64"
  echo
  openssl base64 < /tmp/test.txt) | sendmail -t -i

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how can i handle the attachment of an attachment?

How can I add options to `make` command?

How can I set Ingest attachment(elasticsearch) plugin options with Java API?

Sendmail Attachment

How can I add Options to a Select after a specific Option in jQuery?

How can I add a click listener to ng-select options?

How can I add paragraph text as select options?

How can I add variadic support to options of a Vorpal application

How can I add 'Options' to the gradlew help --task documentation

How can I add an icon to Material UI Select options?

How can I add multiple select options based on some html?

How can i add options menu to fragment from NavigationView

How can I add options to a custom made command?

How can i add more options to a select element in html?

Kotlin - how can I print limited length

How can I add an old email as attachment in replying to a more recent email in Thunderbird?

how can I add icon for attachment in mesibo UI messagens in android SDK?

How can I let the user add an attachment to my app like a pdf or jpg and then how can I store it in my Realm Database?

How can I email a saved blob as attachment?

how can I save an attachment using exchangelib

How can I put a canvas attachment into an embed?

How can I send attachment with ssmtp in Linux?

Can I create and add a text attachment to an Outlook message that is no file?

how can I tell the mail command the path to sendmail?

How can I add my custom component to Mui Theme options so that I can override it?

sendMail Function Limited Characters?

How to add subject to sendmail function

sendmail attachment is empty

How to workaround git add -i --patch being limited to one split?