2

What specific syntax do I use to get mutt to send an email through port 587 on a CentOS 7 server?

For example, the sender is [email protected], the recipient is [email protected], the subject is This is the subject, and the message body is This is the message body..

1 Answer 1

1

In your ~/.muttrc or ~/.mutt/muttrc, files which may be or may not be reside in your home directory, you can add the following lines:

set smtp_url="smtp://[email protected]:587/"
set smtp_pass="insertyourpasswordhere"

This only works if the smtp option is enabled during compilation.

If neither of these files are in your home directory, you should create one of them first. If you have one of them, don't remove content that may be already there. Just make sure that the lines mentioned above contain the correct. Insert your own mailaddress and password of course.

The general method to send a mail with Mutt is like

echo "This is the message body" | mutt -s "This is the subject" [email protected]  

or you can create a textfile with your message body ( let's say /tmp/message.txt) and do this

mutt -s "This is the subject" [email protected] < /tmp/message.txt

If you want to set sender details add the following to muttrc as mentioned above:

set from = "Enteryouremailaddresshere"<br>
set realname = "Yourname"

Mutt commands mentioned here should be one a single line.

6
  • Thank you. However, your response assumes a level of familiarity that would cause a person not to need to ask the question in the first place. Can you please re-state your response in language that gives step by step instructions for a newbie who might do a google search on this topic?
    – CodeMed
    Commented Mar 4, 2015 at 21:57
  • Yes sure, I'll try editing it. Judging by your reputation I thought you were a power user, but of course we deal with other users here too.
    – wie5Ooma
    Commented Mar 4, 2015 at 22:05
  • Thank you and +1 for giving the echo and mutt commands in cut and paste format.
    – CodeMed
    Commented Mar 5, 2015 at 0:46
  • Where exactly do I find or place the muttrc file? When I type sudo find / -name "*muttrc", the only result is: /usr/share/doc/mutt-1.5.21/sample.muttrc. When I try sudo nano /usr/share/doc/mutt-1.5.21/sample.muttrc, the bottom of the file says source ~/.muttrc-local, but then find / -name ".muttrc-local" does not produce any results. Do you suggest that I make a new file called ~/.muttrc or ~/.mutt/muttrc? If so, does the new file go in the root / directory? Or do I make a separate copy of the new file in each /home/username directory?
    – CodeMed
    Commented Mar 5, 2015 at 1:07
  • I am able to send an email from any given username by ssh-ing into that username's CentOS account and typing echo "This is the message body" | mutt -s "This is the subject" [email protected] in the terminal. The message is received by [email protected], but I still do not have any way of confirming that the message was sent out using 587 or any other given port because I have not been able to view the muttrc file or any other output indicating the port number.
    – CodeMed
    Commented Mar 5, 2015 at 1:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .