198 Part III — Conquering Gmail
Listing 14-1 (continued)
....print OUTPUT “Sent:
“ . $full_message->{$id}->{“sent”}
. “\n”;
....print OUTPUT “Subject: “ . strip_bold($full_message>{$id}->{“subject”}) . “\n\n”;
....print OUTPUT $full_message->{$id}->{“body”} . “\n\n---\n”;
}
close OUTPUT;
Running the script produces a file in the directory the script is run from called
mailarchive.txt. It will look rather like this:
Sender: bobette@example.com
Sent: 12:01pm
Subject: This is a mail
You are a very sexy man.
Love
Bob x
---Sender: bobette@example.com
Sent: 11:23pm
Subject: Terrible confession
I’ve lost my wristwatch. Have you seen it?
Puzzled
Bob x
---And so on. Very nice for printing or storing on a keychain flash drive in case of
some form of dreadful server failure at the Google farm. Of course, flippancy aside,
it is nice to have a printout of a series of mails. As you know from previous chapters how to select mails from specific labels, you can use a variation of Listing 14-1
to provide backups of mail specific to certain projects, or subjects, or whatever you
like. That is very useful, depending on your own personal work style.
Listing 14-1 (continued)
....print OUTPUT “Sent:
“ . $full_message->{$id}->{“sent”}
. “\n”;
....print OUTPUT “Subject: “ . strip_bold($full_message>{$id}->{“subject”}) . “\n\n”;
....print OUTPUT $full_message->{$id}->{“body”} . “\n\n---\n”;
}
close OUTPUT;
Running the script produces a file in the directory the script is run from called
mailarchive.txt. It will look rather like this:
Sender: bobette@example.com
Sent: 12:01pm
Subject: This is a mail
You are a very sexy man.
Love
Bob x
---Sender: bobette@example.com
Sent: 11:23pm
Subject: Terrible confession
I’ve lost my wristwatch. Have you seen it?
Puzzled
Bob x
---And so on. Very nice for printing or storing on a keychain flash drive in case of
some form of dreadful server failure at the Google farm. Of course, flippancy aside,
it is nice to have a printout of a series of mails. As you know from previous chapters how to select mails from specific labels, you can use a variation of Listing 14-1
to provide backups of mail specific to certain projects, or subjects, or whatever you
like. That is very useful, depending on your own personal work style.
