SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
I tried this solution and several others, like
Code:
mail -s "Welcome" somemail@gmail.com
, with the above "somemail@gmail.com" substituted by my own gmail address. But then I receive no emails at all.
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!
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.
I don't think you need mutt. I looked at it too, but couldn't figure it out.
If you want to send email using your gmail account with mailx, create this in $HOME/.mailrc
Code:
account gmail {
set folder=imaps://youremail@imap.gmail.com
set password-youremail@imap.gmail.com="yourpassword"
set record=+Sent
set from="Your Name <youremail@gmail.com>"
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=youremail@gmail.com
set smtp-auth-password="yourpassword"
}
Code:
if (!open($fh, "| mailx -A gmail -s \"$subject\" $recipients")) {
print "Error: Couldn't send email.\n";
exit 0;
}
So if you are using mailx make sure you have sendmail installed and running. Then make sure you clear your spam filter.
Last edited by the3dfxdude; 08-31-2012 at 02:27 PM.
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)
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
I tried this solution and several others, like
Code:
mail -s "Welcome" somemail@gmail.com
, with the above "somemail@gmail.com" substituted by my own gmail address. But then I receive no emails at all.
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!
seflyer --
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.