0

Mail body is missing while sending a mail from Ubuntu terminal as:

echo "Test smtp" | sudo ssmtp -vvv test@test.com

The mail is received, but it's body is empty. When I tried manually using the command

sudo ssmtp -vvv test@test.com

and pressing CTRL+D after typing the message, it works fine.

When I tried with this command, the subject is received:

echo "Subject:Test smtp" | sudo ssmtp -vvv test@test.com

But this error message is shown:

[<-] 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A000B81, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:601A0000, 1.36674:0E000000, 1.61250:00000000, 1.45378:651A0000, 1.44866:30020000, 16.55847:1F0D0000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891900101043050000, 20.50032:140F17898917000000000000, 0.35180:48050000, 255.23226:0A001081, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A001181, 0.35250:0A000000, 1.36674:32000000, 1.61250:00000000, 1.45378:02000000, 1.44866:01000000, 16.55847:69000000, 17.43559:00000000F8020000000000000100000000000000, 20.52176:140F17891900101061050000, 20.50032:140F17898917000003000136, 0.35180:66050000, 255.23226:0A001681, 255.27962:32000000, 255.17082:DC040000, 0.27745:0A001781, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0A001881, 0.38698:0F010480, 0.37692:01000000, 0.37948:A7DAB260, 5.33852:00000000534D545000000100, 7.36354:0100000000000109302E3233, 4.56248:DC040000, 7.40748:010000000000010B3A363162, 7.57132:00000000000000006431322D, 1.63016:32000000, 4.39640:DC040000, 8.45434:57402EB65F477B48884BDCB058E3C75D1A010480, 5.10786:0000000031352E32302E323332372E3032353A4D4131505230314D42333634313A36316263646635662D623266372D346431322D623031362D32613231636466383233306400101013000100, 7.51330:EBD4562F8F4CD70800000000, 255.1750:0A002181, 255.31418:03001736, 0.22753:A7050000, 255.21817:DC040000, 4.60547:DC040000, 0.21966:AC050000, 4.30158:DC040000 [Hostname=MA1PR01MB3641.INDPRD01.PROD.OUTLOOK.COM]
ssmtp: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A000B81, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:601A0000, 1.36674:0E000000, 1.61250:00000000, 1.45378:651A0000, 1.44866:30020000, 16.55847:1F0D0000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891900101043050000, 20.50032:140F17898917000000000000, 0.35180:48050000, 255.23226:0A001081, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A001181, 0.35250:0A000000, 1.36674:32000000, 1.61250:00000000, 1.45378:02000000, 1.44866:01000000, 16.55847:69000000, 17.43559:00000000F8020000000000000100000000000000, 20.52176:140F17891900101061050000, 20.50032:140F17898917000003000136, 0.35180:66050000, 255.23226:0A001681, 255.27962:32000000, 255.17082:DC040000, 0.27745:0A001781, 4.21921:DC040000, 255.27962:FA000000, 255.1494:0A001881, 0.38698:0F010480, 0.37692:01000000, 0.37948:A7DAB260, 5.33852:00000000534D545000000100, 7.36354:0100000000000109302E3233, 4.56248:DC040000, 7.40748:010000000000010B3A363162, 7.57132:00000000000000006431322D, 1.63016:32000000, 4.39640:DC040000, 8.45434:57402EB65F477B48884BDCB058E3C75D1A010480, 5.10786:0000000031352E32302E323332372E3032353A4D4131505230314D42333634313A36316263646635662D623266372D346431322D623031362D32613231636466383233306400101013000100, 7.51330:EBD4562F8F4CD70800000000, 255.1750:0A002181, 255.31418:03001736, 0.22753:A7050000, 255.21817:DC040000, 4.60547:DC040000, 0.21966:AC050000, 4.30158:DC040000 [Hostname=MA1PR01MB3641.INDPRD01.PROD.OUTLOOK.COM]
2

You need to add two newlines after the subject to add a mail body. You could try using printf

printf "Subject: Via printf\n\nThis mail body is added via printf" | sudo ssmtp -vvv test@test.com

or using echo with the -e

echo -e "Subject: Via echo\n\nThis mail body is added via echo" | sudo ssmtp -vvv test@test.com
0

According to Arch Linux, ssmtp is unmaintained.

That said after setting it up you can use:

echo -e "Subject: this is the subject\n\nthis is the body" | mail user@example.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.