Using Mutt in Slackware 13
I am working under Slackware 13. This evening I have been trying to write a shell script, in order to send emails (with some attached files) automatically everyday at, say, 8 o'clock.
The first thing, it seems to me, is to let the Mutt work. I googled and see answers like: Code:
mutt -s "my subject" -a attachment-files somemail@gmail.com < email-content.txt Code:
mail -s "Welcome" somemail@gmail.com I think I might need to do something like creating and editing a .rc file. But as the task is a bit urgent, I would like to hear suggestions from experts while investigating the problem. Could anyone help me? Thanks in advance! |
I have a working solution. I don't know if it is exactly what you are looking for. I will send it to you after I get off of work in about 5 hours.
|
Wait, do you have sendmail installed? If you send mails directly from your local machine (non-whitelisted address), you will likely need to whitelist or check your spam box. There is also an alternative to just login to your gmail account and send it to yourself.
I have a few minutes on to log into my server to check what I was doing. This is perl code from my cron job, but the idea is open a pipe to mailx to feed the message to. Code:
if (!open($fh, "| mailx -s \"$subject\" $recipients")) { If you want to send email using your gmail account with mailx, create this in $HOME/.mailrc Code:
account gmail { Code:
if (!open($fh, "| mailx -A gmail -s \"$subject\" $recipients")) { |
Perhaps you could adapt some of this guide, which does not deal with IMAP, to your needs:
http://www.andrews-corner.org/mutt.html I believe it is even written by a Slackware user :). |
To the3dfsdude and andrew.46: thanks for your kind replies!
After struggling with sendmail for a while, it seems to be clear that to let sendmail work, the machine itself (which I am using now) should work like a mail server. And that is complex... After some googling, I turned to mutt+msmtp combination and found them working well. I put the very webpage that helped me out here, in case that anyone would come across similar problems: http://www.viyin.net/2009/08/linux-m...kup-mysql.html (it is a chinese webpage; but ignoring the few chinese characters seems not a problem to follow the whole process) |
Quote:
Sometime in the 'recent' past, mutt changed it's syntax where if you invoke the -a Flag, a '--' flag is REQUIRED after the -a args but before the recipient list. Try this ? Code:
mutt -s "my subject" -a attachment-files -- somemail@gmail.com < email-content.txt ### note -- flag after -a args |
You may find the mail or mailx command easier to use
|
All times are GMT -5. The time now is 07:51 PM. |