<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>That's Winnie &#187; Mac</title>
	<atom:link href="http://www.thatswinnie.com/tag/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thatswinnie.com</link>
	<description></description>
	<lastBuildDate>Sun, 27 Jun 2010 12:35:31 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Googlemail-Backup mit IMAP</title>
		<link>http://www.thatswinnie.com/2008-10-05/googlemail-backup-mit-imap/</link>
		<comments>http://www.thatswinnie.com/2008-10-05/googlemail-backup-mit-imap/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 23:37:41 +0000</pubDate>
		<dc:creator>Winnie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[Googlemail]]></category>
		<category><![CDATA[IMAP]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Terminal]]></category>

		<guid isPermaLink="false">http://www.thatswinnie.com/?p=41</guid>
		<description><![CDATA[Wie schon erwähnt, bin ich auf der Suche nach der perf [...]]]></description>
			<content:encoded><![CDATA[<p>Wie <a href="http://www.thatswinnie.com/2008-09-28/googlemail-backup/">schon erwähnt</a>, bin ich auf der Suche nach der perfekten Lösung, meine Googlemail-E-Mails zu sichern. Und ich denke ich habe sie gefunden: ein Ruby-Script, das die Synchronisation zwischen meinem Googlemail-Account und einem zweiten IMAP-Account übernimmt. Synchronisation ist dabei vielleicht das falsche Wort, es ist eher ein Backup, was den zweiten IMAP-Account auf dem gleichen Stand wie den Googlemail-Account hält.<br />
Die Basis für das Script kommt von <a href="http://wonko.com/post/ruby_script_to_sync_email_from_any_imap_server_to_gmail" target="_new">Ryan Grove</a>. Ich habe das Löschen von Nachrichten und die Ordner-Auflistung hinzugefügt.<br />
<span id="more-41"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'net/imap'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Source server connection info.</span>
SOURCE_HOST = <span style="color:#996600;">'imap.googlemail.com'</span>
SOURCE_PORT = <span style="color:#006666;">993</span>
SOURCE_SSL  = <span style="color:#0000FF; font-weight:bold;">true</span>
SOURCE_USER = <span style="color:#996600;">'EMAIL@googlemail.com'</span>
SOURCE_PASS = <span style="color:#996600;">'PASSWORT'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Destination server connection info.</span>
DEST_HOST = <span style="color:#996600;">'imap.SERVER.com'</span>
DEST_PORT = <span style="color:#006666;">143</span>
DEST_SSL  = <span style="color:#0000FF; font-weight:bold;">false</span>
DEST_USER = <span style="color:#996600;">'USER'</span>
DEST_PASS = <span style="color:#996600;">'PASSWORT'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># List of all Folder that should not be synced</span>
FOLDERS_EXCLUDE = <span style="color:#006600; font-weight:bold;">&#91;</span>
  <span style="color:#996600;">'[Google Mail]'</span>,
  <span style="color:#996600;">'[Google Mail]/Sent Mail'</span>, 
  <span style="color:#996600;">'[Google Mail]/Spam'</span>,
  <span style="color:#996600;">'[Google Mail]/Trash'</span>
<span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Utility methods.</span>
<span style="color:#9966CC; font-weight:bold;">def</span> dd<span style="color:#006600; font-weight:bold;">&#40;</span>message<span style="color:#006600; font-weight:bold;">&#41;</span>
   <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;[#{DEST_HOST}] #{message}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> ds<span style="color:#006600; font-weight:bold;">&#40;</span>message<span style="color:#006600; font-weight:bold;">&#41;</span>
   <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;[#{SOURCE_HOST}] #{message}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Connect and log into both servers.</span>
ds <span style="color:#996600;">'connecting...'</span>
source = <span style="color:#6666ff; font-weight:bold;">Net::IMAP</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>SOURCE_HOST, SOURCE_PORT, SOURCE_SSL<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
ds <span style="color:#996600;">'logging in...'</span>
source.<span style="color:#9900CC;">login</span><span style="color:#006600; font-weight:bold;">&#40;</span>SOURCE_USER, SOURCE_PASS<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
dd <span style="color:#996600;">'connecting...'</span>
dest = <span style="color:#6666ff; font-weight:bold;">Net::IMAP</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>DEST_HOST, DEST_PORT, DEST_SSL<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
dd <span style="color:#996600;">'logging in...'</span>
dest.<span style="color:#9900CC;">login</span><span style="color:#006600; font-weight:bold;">&#40;</span>DEST_USER, DEST_PASS<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Getting the folders to sync</span>
folders = <span style="color:#CC0066; font-weight:bold;">Array</span>.<span style="color:#9900CC;">new</span>
source.<span style="color:#9900CC;">list</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;&quot;</span>, <span style="color:#996600;">&quot;%&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>mailbox<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> FOLDERS_EXCLUDE.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>mailbox.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#0000FF; font-weight:bold;">false</span>
        folders <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> mailbox.<span style="color:#9900CC;">name</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">if</span> mailbox.<span style="color:#9900CC;">attr</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Net::IMAP::NOSELECT</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        source.<span style="color:#9900CC;">list</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;&quot;</span>, <span style="color:#996600;">&quot;#{mailbox.name}/%&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>mailboxChild<span style="color:#006600; font-weight:bold;">|</span>
            <span style="color:#9966CC; font-weight:bold;">if</span> FOLDERS_EXCLUDE.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>mailboxChild.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#0000FF; font-weight:bold;">false</span>
                folders <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> mailboxChild.<span style="color:#9900CC;">name</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
        <span style="color:#9966CC; font-weight:bold;">end</span> 
    <span style="color:#9966CC; font-weight:bold;">end</span> 
<span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#008000; font-style:italic;">#puts folders</span>
&nbsp;
&nbsp;
<span style="color:#008000; font-style:italic;"># Loop through folders and copy messages.</span>
folders.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>foldername<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#008000; font-style:italic;"># Open source folder in read-only mode.</span>
  <span style="color:#9966CC; font-weight:bold;">begin</span>
    ds <span style="color:#996600;">&quot;selecting folder '#{foldername}'...&quot;</span>
    source.<span style="color:#9900CC;">examine</span><span style="color:#006600; font-weight:bold;">&#40;</span>foldername<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> e
    ds <span style="color:#996600;">&quot;error: select failed: #{e}&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">next</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Open (or create) destination folder in read-write mode.</span>
  <span style="color:#9966CC; font-weight:bold;">begin</span>
    dd <span style="color:#996600;">&quot;selecting folder '#{foldername}'...&quot;</span>
    dest.<span style="color:#CC0066; font-weight:bold;">select</span><span style="color:#006600; font-weight:bold;">&#40;</span>foldername<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> e
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      dd <span style="color:#996600;">&quot;folder not found; creating...&quot;</span>
      dest.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span>foldername<span style="color:#006600; font-weight:bold;">&#41;</span>
      dest.<span style="color:#CC0066; font-weight:bold;">select</span><span style="color:#006600; font-weight:bold;">&#40;</span>foldername<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> ee
      dd <span style="color:#996600;">&quot;error: could not create folder: #{e}&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">next</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Build a lookup hash of all message ids present in the destination folder.</span>
  dest_info = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  dd <span style="color:#996600;">'analyzing existing messages...'</span>
  uids = dest.<span style="color:#9900CC;">uid_search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ALL'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> uids.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span>
    dest.<span style="color:#9900CC;">uid_fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span>uids, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>data<span style="color:#006600; font-weight:bold;">|</span>
      dest_info<span style="color:#006600; font-weight:bold;">&#91;</span>data.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">message_id</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF; font-weight:bold;">true</span>      
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Loop through all messages in the source folder.</span>
  uids = source.<span style="color:#9900CC;">uid_search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ALL'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> uids.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span>
    source.<span style="color:#9900CC;">uid_fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span>uids, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>data<span style="color:#006600; font-weight:bold;">|</span>
      mid = data.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">message_id</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># If this message is already in the destination folder, skip it.</span>
      <span style="color:#9966CC; font-weight:bold;">next</span> <span style="color:#9966CC; font-weight:bold;">if</span> dest_info<span style="color:#006600; font-weight:bold;">&#91;</span>mid<span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Download the full message body from the source folder.</span>
      ds <span style="color:#996600;">&quot;downloading message #{mid}...&quot;</span>
      msg = source.<span style="color:#9900CC;">uid_fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span>data.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'UID'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RFC822'</span>, <span style="color:#996600;">'FLAGS'</span>,
          <span style="color:#996600;">'INTERNALDATE'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">first</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Append the message to the destination folder, preserving flags and</span>
      <span style="color:#008000; font-style:italic;"># internal timestamp.</span>
      dd <span style="color:#996600;">&quot;storing message #{mid}...&quot;</span>
      dest.<span style="color:#9900CC;">append</span><span style="color:#006600; font-weight:bold;">&#40;</span>foldername, msg.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RFC822'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, msg.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'FLAGS'</span><span style="color:#006600; font-weight:bold;">&#93;</span>,
          msg.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'INTERNALDATE'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
&nbsp;
&nbsp;
  <span style="color:#008000; font-style:italic;"># Build a lookup hash of all message ids present in the source folder.</span>
  source_info = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  dd <span style="color:#996600;">'analyzing source messages...'</span>
  uids = source.<span style="color:#9900CC;">uid_search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ALL'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> uids.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span>
    source.<span style="color:#9900CC;">uid_fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span>uids, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>data<span style="color:#006600; font-weight:bold;">|</span>
      source_info<span style="color:#006600; font-weight:bold;">&#91;</span>data.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">message_id</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF; font-weight:bold;">true</span>      
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Loop through all messages in the source folder.</span>
  uids = dest.<span style="color:#9900CC;">uid_search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ALL'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> uids.<span style="color:#9900CC;">length</span> <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006666;">0</span>
     dest.<span style="color:#9900CC;">uid_fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span>uids, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>data<span style="color:#006600; font-weight:bold;">|</span>
      mid = data.<span style="color:#9900CC;">attr</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'ENVELOPE'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">message_id</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># If this message is already in the destination folder, skip it.</span>
      <span style="color:#9966CC; font-weight:bold;">next</span> <span style="color:#9966CC; font-weight:bold;">if</span> source_info<span style="color:#006600; font-weight:bold;">&#91;</span>mid<span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
      <span style="color:#008000; font-style:italic;"># Setting flag for deletion</span>
      ds <span style="color:#996600;">&quot;deleting message #{mid}...&quot;</span>
     dest.<span style="color:#9900CC;">store</span><span style="color:#006600; font-weight:bold;">&#40;</span>data.<span style="color:#9900CC;">seqno</span>, <span style="color:#996600;">&quot;+FLAGS&quot;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:Deleted</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
&nbsp;
  dest.<span style="color:#9900CC;">expunge</span>
  source.<span style="color:#9900CC;">close</span>
  dest.<span style="color:#9900CC;">close</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">'done'</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thatswinnie.com/2008-10-05/googlemail-backup-mit-imap/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Googlemail-Backup</title>
		<link>http://www.thatswinnie.com/2008-09-28/googlemail-backup/</link>
		<comments>http://www.thatswinnie.com/2008-09-28/googlemail-backup/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 18:46:24 +0000</pubDate>
		<dc:creator>Winnie</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[fetchmail]]></category>
		<category><![CDATA[Googlemail]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Terminal]]></category>

		<guid isPermaLink="false">http://www.thatswinnie.com/?p=40</guid>
		<description><![CDATA[Das Bedürfnis, meine E-Mail vom Googlemail-Server zu s [...]]]></description>
			<content:encoded><![CDATA[<p>Das Bedürfnis, meine E-Mail vom Googlemail-Server zu sichern ist in den letzten Wochen extrem gestiegen. Grund dafür sind immer wieder Schauermärchen von gesperrten Mail-Accounts. Deswegen habe ich mich auf die Suche nach einer Backup-Möglichkeit für meine E-Mails gemacht und bin bei fetchmail fündig geworden. Fetchmail ist auf dem Mac unter Leopard vorinstalliert.<br />
<span id="more-40"></span><br />
Um Mails mit fetchmail empfangen zu können, muss man als erstes ein Zertifikatsverzeichnis einrichten und die nötigen SSL-Zertifikate von Googlemail herunterladen. Dazu gibt man im Terminal folgende Zeilen ein:<br />
<code><br />
mkdir ~/.certs<br />
cd ~/.certs<br />
openssl s_client -connect pop.googlemail.com:995 -showcerts </dev/null<br />
</code></p>
<p>Aus den Ausgaben im Terminal kopiert man sich das Zertifikat, das aus folgenden Zeilen besteht:<br />
<code><br />
-----BEGIN CERTIFICATE-----<br />
(viele Buchstaben)<br />
-----END CERTIFICATE-----<br />
</code></p>
<p>Nun muss das Zertifkat in eine Datei geschrieben werden:<br />
<code><br />
touch googlemailpop.pem<br />
sudo pico googlemailpop.pem<br />
</code></p>
<p>Jetzt kann das Zertifikat hineinkopiert werden. Mit CTRL + X kann man die Datei verlassen und muss das Speichern noch mit Y bestätigen.</p>
<p>Nun werden noch ein Zertifikate von Equifax benötigt. Dazu muss man sich von der <a href="http://www.geotrust.com/resources/root_certificates/index.asp" target="_new">Equifax-Seite</a> das “Equifax Secure Certificate Authority (Base-64 encoded X.509)” herunterladen, nach "equifax.pem" umbenenennen und in den Zertifikatsordner kopieren. </p>
<p>Fehlt nur noch das Hashen der Zertifkate:<br />
<code><br />
c_rehash .<br />
</code></p>
<p>Um das eigentlich Abholen seiner E-Mails einzurichten, muss die Konfigurations-Datei von fetchmail eingerichtet und bearbeitet werden:<br />
<code><br />
touch ~/.fetchmailrc<br />
chmod 710 ~/.fetchmailrc<br />
sudo pico ~/.fetchmailrc<br />
</code></p>
<p>Hier muss der folgende Text eingefügt werden - der natürlich vorher um die eigenen Zugangsdaten ergänzt werden muss:<br />
<code><br />
poll pop.googlemail.com with proto POP3 and options no dns<br />
user 'GOOGLEMAIL_USERNAME@googlemail.com' there with password 'GOOGLEMAIL_PASSWORD' is 'LOCAL_USERNAME' here and wants mda "/usr/bin/procmail -d %T"  options ssl keep sslcertck sslcertpath "/Users/LOCAL_USERNAME/.certs"<br />
</code><br />
Und auch gilt wieder: Mit CTRL + X kann man die Datei verlassen und muss das Speichern mit Y bestätigen.</p>
<p>Letzter Schritt: Mails abrufen<br />
<code><br />
fetchmail -v --fetchall --invisible<br />
</code></p>
<p>Die E-Mails werden in der Datei /var/mail/LOCAL_USERNAME abgelegt. Falls das Abrufen der E-Mails nicht klappt, sollte man in seinem Googlemail-Account überprüfen, ob das Abrufen per POP eingestellt ist (Einstellungen / Weiterleitung und POP/IMAP / POP für alle Nachrichten (auch bereits heruntergeladene) aktivieren).</p>
<p>Als ein Zusatzfeature zu Schluss sollte man sich noch einen automatisierten Job einrichten, der die E-Mails einmal am Tag abruft, damit man das nicht manuell über das Terminal machen muss. Dazu empfehle ich, den Artikel "<a href="http://developer.apple.com/macosx/launchd.html">Getting Started with launchd</a>" bei Apple durchzulesen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thatswinnie.com/2008-09-28/googlemail-backup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
