LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-07-2010, 02:24 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 51
How to let MUTT create 10 TXT files of the last Emails?


Hello,

I am coding some scripts for sending via irda to my PDA with another irda that has a triggering on the remote control. OK. What I would need is as follows.


With MUTT, I configured it so that I can read my emails with the IMAP and gmail. It is cool. It is working with the last
Code:
mutt --version
mutt: invalid option -- '-'
Mutt 1.5.20 (2009-06-14)
which is annoying with "--" but ok, it works.

I would like that a script export the last 10 emails to 10 x TXT files with in it:
Code:
Subject
sender
receiver
containing
How to manage such thing?



Quote:
Using Gmail with mutt, the minimal way (IMAP update)

with 42 comments

As Gmail has IMAP access, it is fairly trivial to get it working with mutt. First, if you’re on Ubuntu/Debian, run sudo apt-get install openssl mutt to get mutt if you don’t already have it. Then, just put the following lines into your ~/.muttrc:

set imap_user = "username@gmail.com"
set imap_pass = "password"

set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = "password"
set from = "username@gmail.com"
set realname = "Your Real Name"

set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no

Make sure your ~/.muttrc isn’t world-readable; it contains your password. (Alternatively, you can leave them out and mutt will prompt you for the password each time.) Also, if you copy-paste from the above, make sure that you have only “normal” quotes, not “smart quotes” which WordPress might have inserted here into this post.

[Other things I have:

set sort = 'threads'
set sort_aux = 'last-date-received'
set imap_check_subscribed

ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc

I did not include above to justify the "minimal" ]

Things work perfectly as you would expect them.
One thing to note is that the full headers will still contain the hostname of the computer you send messages from. I have not figured a way of hiding this, and perhaps it shouldn’t be possible.

The End

If for some reason you want to use POP, read on. And tell me why you would want to use POP. The rest of the post is an old version, which i had written before Gmail supported IMAP.
 
Old 03-07-2010, 03:31 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,140
Blog Entries: 54

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
Quote:
Originally Posted by frenchn00b View Post
I would like that a script export the last 10 emails to 10 x TXT files (..) How to manage such thing?
I'd probably choose Fetchmail to D/L messages and let 'procmail' be the local MDA to create text files with a recipe. Wouldn't be that hard but you should be careful who you write text files as (not root), where you write them (using 'mktemp') and what you write (as in not accepting any input unchecked). If that sounds interesting then read the fetchmail and procmail manual pages, create a fetchmail.conf and a procmail recipe and post them if it doesn't work. Of course you may find utilities at Freshmeat or Sourceforge that combine everything like FDM. Haven't tried it myself though.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create 1 csv file from multiple txt files richmur Programming 10 09-03-2008 01:28 PM
delete one day old emails through mutt comnand line chramesh19 Programming 0 12-27-2007 02:30 AM
Mutt stopped sending emails without an error ille.pugil42 Linux - Software 1 06-23-2006 03:45 PM
mutt bouncing replies to emails pbaumgar Linux - Software 0 08-18-2004 09:12 PM
How to get emails in my yahoo.com or sina.com by using mutt or mail? whepin Linux - General 2 12-31-2001 06:35 AM


All times are GMT -5. The time now is 11:48 PM.

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