Mail Aggregator 1.0

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Mail Aggregator 1.0

Postby bigfoot65 » Sun Jul 19, 2009 12:15 pm

ALL,

I have been diligently working to establish a mail aggregator for Amahi. The scope is to have an IMAP server on the HDA to store all mail in central location. This would be accessible via webmail (Squirrel Mail) or email client to anyone on the network. I have created 2 versions, one with getmail support and one without (lite). There are 3 scripts for each version to make this all work, install, add user, and delete user. I will post them here for anyone who wants to try them out. Now for the catch, root permissions is required to do the install. Oh, also have an uninstall script too. Not sure if we can make this a one-click app at some point, but would be nice.

Here's the important steps to follow:
1. Create a web app called 'webmail'
2. Place the script files in /var/hda/web-apps/webmail/html and go to that directory
3. chmod 755 *.sh to make the executable
4. Run the applicable script (lite or normal) and enter data when requested.
5. When it finishes, enter webmail in the browser to access.

NOTE: User names cannot be existing linux users.

Now, this is where I need help. Everything seems to work fine, except sending mail. It's an issue with mail relay host and/or possibly send mail. You can send mail with the email client, providing you set it up to use your ISP. That's what I tried to do with the webmail, but it's not working for some reason.

Anyone who can help me get this working, post a reply here. This is by no means a finished product and development is ongoing.
Attachments
mail-aggregator.zip
(8.47 KiB) Downloaded 367 times
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Mail Aggregator 1.0

Postby moredruid » Sun Jul 19, 2009 1:28 pm

how do you define the ISP smtp server?
it should be done like this:
Edit sendmail.mc not sendmail.cf:
define(`SMART_HOST', `the.other.host')dnl
regenerate sendmail.cf with

Code: Select all

m4 < sendmail.mc >sendmail.cf
if you get an error with m4 you will need to install the sendmail-cf rpm
reload or restart sendmail and you should be good to go
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Mail Aggregator 1.0

Postby bigfoot65 » Wed Jul 22, 2009 11:13 am

Thanks for the tip moredruid.

I have been working hard to get this to be as simple as possible and still work. I am posting the first revision of the lite version of mail aggregator. This does not include the automatic getmail support, but works well based on my tests so far. There are 4 scripts: install, add new users, delete users, and finally uninstall the app entirely. Remember, the scripts must be run as root user.

There are some key pieces of information that is needed to make this work. You need to know your Internet Service Provider (ISP) POP server, SMTP server, email address, and password. This data will provide you with the means to send mail from your HDA, via your ISP.

For those who want to retrieve their mail, the webmail (Squirrelmail) application has a fetch feature which will allow you to retrieve your mail. This is already programmed using the ISP information you provided earlier. Additional email accounts can be added as needed using the Options link in the webmail interface.

My goal is at some point to make this a one-click Amahi application. Hope this will be beneficial for many of you as it is for me. If you have any questions or comments, please post them here.

P.S. I will be updating the full version soon ;)
Attachments
mail-aggregator-lite-1.1.zip
(7.57 KiB) Downloaded 363 times
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

User avatar
cpg
Administrator
Posts: 2618
Joined: Wed Dec 03, 2008 7:40 am
Contact:

Re: Mail Aggregator 1.0

Postby cpg » Wed Jul 22, 2009 12:03 pm

This is really nice and exciting. Many people have been asking for an email app like this.

For the UI, we have several examples of (native) apps that have UI elements, and that is something that can be done in a reasonable amount of time. Native apps are in RoR, however, perhaps someone can make a php or python front end to it.

Keep up the good work!
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 8GB RAM, 1TBx2+3TBx1

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Mail Aggregator 1.0

Postby moredruid » Thu Jul 23, 2009 1:25 am

cpg, could you draft the requirements for this app?
with a set goal it's easier to implement it since you know what target you're aiming for.

basically what I'd like to see is:
  • webmail support
    native client support (with multiple POP/IMAP accounts and sending through hda (smtp relay))
    create aliases (e.g. let info@ be sent to 1 or more people in your org.)
    option to choose between dedicated mail (own mailserver, not my idea but frequently asked) and relay host (mail is fetched and stored on hda, then retrieved from hda)
the last one may be a bit tricky so that might be split into separate apps.
I'd be willing to help out with the scripts, I'll setup my git as soon as I have a good working vm environment.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Mail Aggregator 1.0

Postby bigfoot65 » Thu Jul 23, 2009 7:34 am

As a matter of fact, I am working on a version now that adds many of those features. It's based on a tutorial at howtoforge.net by falko titled 'Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (F10).' Most of the features will satisfy the list moredruid noted.

This version is close to being ready for the first test run. I will post it here for others to try. If anyone would like to assist, please let me know.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

User avatar
cpg
Administrator
Posts: 2618
Joined: Wed Dec 03, 2008 7:40 am
Contact:

Re: Mail Aggregator 1.0

Postby cpg » Thu Jul 23, 2009 9:18 am

niiiice! i think most of the requirements are right (i don't know about the "create aliases", since it may require touching some other files like /etc/aliases in an intelligent way), but otherwise that would be a heck of a tall order!
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 8GB RAM, 1TBx2+3TBx1

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Mail Aggregator 1.0

Postby moredruid » Fri Jul 24, 2009 7:20 am

meh...
what's intelligent?
you need to check if $foo is already in /etc/aliases and if it is append it with $bar
if $foo is not in /etc/aliases, create it and append it with $bar

sample code:

Code: Select all

#!/bin/bash # read from stdin read alias accountname if [ -z $accountname ]; then echo "I need 2 parameters" else exists=`grep -c $alias /etc/aliases` if [ $exists -eq 0 ]; then echo "$alias: $accountname" >> /etc/aliases else alias2=`grep "^${alias}:" /etc/aliases` tempfile=`mktemp` grep -v "$alias2" /etc/aliases > $tempfile echo "${alias2}, $accountname" >> $tempfile mv /etc/aliases /etc/aliases.old mv $tempfile /etc/aliases fi fi
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Mail Aggregator 1.0

Postby bigfoot65 » Fri Jul 24, 2009 7:53 am

There shouldn't be an issue with /etc/aliases as there is only one thing added. It ensures that postmaster points to root and root to your own username or your email address. This is done on initial install only. Any other aliases for email addresses or users is stored in the database.

This step could be eliminated if necessary too. Hope that helps clear things up a bit. I am almost finished with version 1.1 and will be posting it soon.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Mail Aggregator 1.0

Postby moredruid » Fri Jul 24, 2009 10:54 am

forgot to mention you need to run the command "newaliases" after adding the new aliases.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

Who is online

Users browsing this forum: No registered users and 66 guests