In case this is useful to someone trying to get mailgate up an running, have a look.
I put this little procedure together so I can reference it later. Based on what's in the book and hda's threads. Running on ubuntu 8.04.
Getting OpenERP to send / receive email using mailgate
1)Start OpenERP server with the smtp flag using an open relay SMTP server. This setting is what allows OpenERP to send out emails.
python openerp-server.py --smtp 172.30.0.10
The above example uses spamtitan on the LAN. My experimentation with SBS was a bit difficult here since you don’t really want to allow open relay. Another possible solution if something like SpamTitan or the ISP’s SMTP server is not available is to install sendmail or a similar program on the OpenERP box and have it relay.
2)Fetchmail – Fetchmail is used to get a copy of emails from the email server and then run an Openerp python script to import/create cases in the system automatically depending on the settings below.
a.Install Fetchmail
i. sudo apt-get install fetchmail
b.create file called fetchmailrc (this should be in the same directory you run fetchmail from)
i. gedit fetchmailrc
ii.File contents:
# fetchmailrc
poll 172.30.0.20 proto imap:
username helpdeskqueue password abc123 mda “/home/colin/openerp-dev/3/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py –u 1 –p admin –s 3 –e
helpdeskqueue@company.com –d admin”
iii.File contents explained:
1.The poll command is pointed to your mail server. The proto (short for protocol) can be IMAP or POP depending on what is available.
2.* note – the commands/entries above are all separated by a space
3.username – the email account username
4.password – the email user password
5.mda – flag to pass all the stuff in double quotes to fetchmail and allows the python scripts to run.
6./home/colin/openerp-dev/.... – this is the path to the openerp-mailgate.py file
7.–u 1 -this is the id number of the user in OpenERP that will access the database. Log on to openerp and check this ID field. In this example id 1 is the admin user.
8.–p -this is the password of the openerp user from above
9.–s 3 - s stands for Section. The sections are CRM --> Configuration--> Cases --> Sections. Like the user ID each section has an ID number and this needs to be put here.
10.–e -the email address of the email account
11.–d -the name of the database stored in Postgres
c.Running Fetchmail - keep in mind that this command runs fetchmail once, it's not continuously grabbing emails, but it's enough for testing and to get started.
i.Command syntax –
fetchmail –v –k –f fetchmailrc
ii.Command syntax explained
1.–v this is the verbose flag. This is Optional.
2.–k this makes fetchmail leave a copy of the email fetched on the server. For IMAP this needs to be set but possibly not for POP.
3.–f this tells fetchmail we will be passing a file with additional commands, in this case the file is called fetchmailrc. Actually any file name seems to work.
Sorry about the formatting, this had been cut and pasted from a word doc.
That's it. Now you can send emails to the mailbox you set up above and after running fetchmail OpenERP will automatically create the case in the system
The 'Send Partner & Historize' button will also work providing your smtp server is happy about relaying emails from OpenERP.