LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-31-2012, 11:15 AM   #1
seflyer
Member
 
Registered: Apr 2010
Distribution: Slackware32-13.37
Posts: 51

Rep: Reputation: 15
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
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!
 
Old 08-31-2012, 02:10 PM   #2
the3dfxdude
Member
 
Registered: May 2007
Posts: 315

Rep: Reputation: 84
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.
 
Old 08-31-2012, 02:24 PM   #3
the3dfxdude
Member
 
Registered: May 2007
Posts: 315

Rep: Reputation: 84
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")) {
    print "Error: Couldn't send email.\n";
    exit 0;
  }
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.
 
Old 08-31-2012, 09:45 PM   #4
andrew.46
Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 645

Rep: Reputation: 90
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 .
 
Old 09-02-2012, 07:58 AM   #5
seflyer
Member
 
Registered: Apr 2010
Distribution: Slackware32-13.37
Posts: 51

Original Poster
Rep: Reputation: 15
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)
 
Old 09-03-2012, 04:50 AM   #6
kjhambrick
Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware-64 -current
Posts: 57

Rep: Reputation: 25
Quote:
Originally Posted by seflyer View Post
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
-- kjh
 
Old 09-03-2012, 11:56 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,202

Rep: Reputation: 291Reputation: 291Reputation: 291
You may find the mail or mailx command easier to use
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mutt does not honour mutt.rc 'use_from' entry when accepting piped input davidchall Linux - Software 0 05-28-2012 02:13 AM
Slackware 13.1, mutt, and urlview x360539 Linux - Software 3 11-20-2010 04:09 PM
Mutt - Slackware-Current tpreitzel Slackware 10 11-11-2010 08:54 PM
Mutt in Slackware 12.2--no SMTP? wilson47 Slackware 5 01-22-2009 09:12 AM
Mutt & Spanish in Slackware kpto Slackware 4 09-06-2003 12:44 PM


All times are GMT -5. The time now is 02:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration