Script to configure Gmail as relayhost in postfix

ramoncio

Joined
May 12, 2010
Messages
1,663
Likes
0
Points
0
#1
With this script you can configure Gmail using sasl auth as relayhost for postfix, to deliver all your emails.
If you run it as it is, it starts asking the user for the gmail credentials and some data needed to customize the SSL certificate, but it can also be easily made fully unattended, assigning values to the variables and removing the first lines (starting with read).

Code:
wget http://www.lolacolay.com/ramon/postfixgmail.sh
chmod +x postfixgmail.sh
./postfixgmail.sh
 

Acidizer

Joined
Mar 11, 2010
Messages
6
Likes
0
Points
0
#2
That was peace of cace to set up even for complete NOB like i am, thanks a lot :)
 

rollinsolo

Joined
Feb 11, 2009
Messages
279
Likes
0
Points
0
#3
+1 to you for that, will this work for different types of email accounts that require authentication, I am thinking once I set up a user and new password I can modify the script to create the certs for their email host instead, it is not gmail.
 

bhallottawa

Joined
Jun 6, 2010
Messages
14
Likes
0
Points
0
#4
This worked Awesome!

Thanks
Bob
 

rollinsolo

Joined
Feb 11, 2009
Messages
279
Likes
0
Points
0
#5
Ramoncio the only thing I would change in the script is who sends the email in vm_general.inc in /etc/asterisk, if you change serveremail, who the email appears to come from which would be the email used to authenticate mail this script works for any email server out there, well gmail and an exchange server hosted in the Amazon Cloud, the only other file I had to change was /etc/postfix/generic and take out anything before the first @ sign so the line looks similar to @pbx.local username@gmail.com
then do a postmap /etc/postfix/generic and restart postfix or reboot server and email will go through authenticating to just about anyone.
Thanks for this could not have done it for a customer of mine without this.
 

rollinsolo

Joined
Feb 11, 2009
Messages
279
Likes
0
Points
0
#6
I also see you lost your Karma somehow well heres one more for this.
 

ramoncio

Joined
May 12, 2010
Messages
1,663
Likes
0
Points
0
#7
Thanks for that!!

Someone took my karma away, I see...
I'll have to start over :(
 

rollinsolo

Joined
Feb 11, 2009
Messages
279
Likes
0
Points
0
#8
If they can fix it I think you were at least 60+ I left you one for the script and then noticed your were at 0 again, kinda sucks FIX IT GUYS he earned each and every one of those. Side note Ramoncio do you know how to make UUCP send mail as root my voicemail to email goes thru authenticated using your script but faxes are being sent from=<uucp@pbx.local> as opposed to from=<asterisk@pbx.local> and are being rejected because the sender does not have permission to send as this sender, I am trying to tread lightly because its a customer production server, also hard to replicate on my own because they use their own mail client and mine is working both ways using Gmail. Thanks.
 

rnrover

Joined
Aug 2, 2009
Messages
73
Likes
0
Points
6
#9
Fantastic Script. I spent half a day trying to get email working before I found your script. It took 5 minutes once I got your script.

Thanks again :woohoo:
 

mambo

Joined
Aug 2, 2011
Messages
11
Likes
0
Points
0
#10
Re: Re:Script to configure Gmail as relayhost in postfix

Excelent ... very good script..thk.
 

benboone

Joined
Sep 1, 2012
Messages
6
Likes
0
Points
0
#11
I have setup postfix before but this was by far the easiest setup for gmail relay that I have ever done. thanks!!
 

oscarbello84

Joined
Jun 4, 2010
Messages
2
Likes
0
Points
0
#12
Hello, I'm trying to run the script in a CentOS-6.3 server and I get this error:

Starting postfix: [ OK ]
Generating DSA parameters, 1024 bit long prime
This could take some time
.......+.....+..+................+++++++++++++++++++++++++++++++++++++++++++++++++++*
.....+...........+.+...+...+.........+.....+..+...+.........+.+.......+......+....................+.................+..............+...................+.......+.............................................+.+.+.....+.....+...........+...+.......+..............+.....+....+.........+....+...........+.+..........+.......+...........+...+.............+.+.+.+........+.....+..+..+........+.+....+.......+.....+..+.....+.......+......+.......................+..................+++++++++++++++++++++++++++++++++++++++++++++++++++*
Generating a 1024 bit DSA private key
writing new private key to 'mykey.pem'
-----
140229566310216:error:0606B06E:digital envelope routines:EVP_SignFinal:wrong public key type:p_sign.c:142:
140229566310216:error:0D0C3006:asn1 encoding routines:ASN1_item_sign:EVP lib:a_sign.c:279:
140237058017096:error:0606B06E:digital envelope routines:EVP_SignFinal:wrong public key type:p_sign.c:142:
140237058017096:error:0D0C3006:asn1 encoding routines:ASN1_item_sign:EVP lib:a_sign.c:279:

Cual puede ser la causa?
 

rehan22

Joined
Nov 8, 2012
Messages
1
Likes
0
Points
0
#13
where is the script?

Regards,
Rehan
 

benboone

Joined
Sep 1, 2012
Messages
6
Likes
0
Points
0

jgutierrez

Joined
Feb 28, 2008
Messages
5,737
Likes
0
Points
0
#15
Now you can do it from the web interface, go to Email module, Remote SMTP and select gmail.
 

apmuthu

Joined
Aug 1, 2009
Messages
60
Likes
0
Points
0
#16
Can someone repost this script as the link is not working now.
 

Damian_Carter

Joined
Aug 10, 2013
Messages
43
Likes
0
Points
0
#17
I see the newest version has gmail accounts built in. However it doesn't work as indicated by the elastix bible :)

can I use this utility to repair the issue? I do not see a specific instruction on how to implement this script. Also I will try this on a non production box before implementing this. Again thanks in advance for your help
 

Amphibian

Joined
Sep 8, 2009
Messages
1,128
Likes
2
Points
38
#18
Damian_Carter,

Gmail does work in version 2.04 if you go to "remote smtp" and set it up there. The only issue I had in the beginning was the right port number (587 or 25). Once that was corrected all worked fine to this day.


amphibian
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,913
Messages
130,917
Members
17,589
Latest member
cristian.saiz
Top