Forums / General Questions / Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Locked
Results 1 to 20 of 41
This thread is locked. New replies are disabled.
13 Apr 2007, 15:13
#1
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Hi

Now I know this all seems to be a little long in the tooth with the gmail thing.

I have a home server and it runs Ubuntu Linux 6.06.
I have installed zencart in my webspace and I am really excited about this program but my git of an ISP has blocked port 25 for spam reasons.

I have been reading all the gmail posts and tried most things inc. usins sendmail, smtp, smtpauth. I have tried ports 587 and 465.

Nothing seems to work. My gmail accout is a hosted account.

It ask's for the starttls stuff that I have read zencart is unable to do at present but is there a way to run a mail server on my home server and relay it on to gmail using the starttls function?

Also is there a way to alter the sendmail config to do this?

Thanks for your help in advance.

Revsie
13 Apr 2007, 21:44
#2
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

The short answer is yes, you can install a mail server on an Ubuntu 6.06 home server. However, your post covers an awful lot of ground, so it is possibily not true to say that it will solve your problem. If your ISP is blocking port 25 your mail server might find it difficult to talk to any other mail servers.
This can be solved if your domain registrar has default mail servers for your domain, by using port 587 or similar to transfer mail between your server and the domain servers.
regarding Gmail, it sounds to me as if you are trying to get Gmail to relay mail on behalf of your domain, which is probably not going to impress Gmail very much. This may well not be the case with a Google Apps setup, but there are DNS MX record considerations at your domain reg. If I remember correctly, Gmail uses ports 465 and 995, not 587.
Regarding a local mail server on your Ubuntu machine, a potential advantage is that it would enable your Zencart to use PHP for the mail transport, simplifying your local config. I'd suggest Postfix rather than sendmail, as sendmail is not for the faint hearted. howtoforge.com have a perfect ubuntu 6.06 setup that might be useful.
14 Apr 2007, 09:08
#3
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Thanks for the advice Chuckl. I will try postfix but must admit I have not had much luck in the past.

My server used to have windows running it but I decided to change to Linux for the experience and also the safer more secure OS that it is.

I have been reading a lot on the How to Forge website which is where I got the info for setting my linux server up in the first place.

I will give it a go but if you find a good step by step guide for a linux newbie on how to set this up please let me know.

Thanks again Chuckl.
14 Apr 2007, 10:58
#4
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

For the first Ubuntu server I set up to evaluate it, I simply followed the howtoforge perfect setup in toto, using IspConfig etc, and added Webmin as an alternate/additional admin frontend. That gets you a fairly solid and secure base.
That said, if you get any funnies or error messages during that process, investigate and fix.
You could also install VmWare and download the IspConfig appliance and install it, which gives a similar result, but a bit of computer horsepower is needed, and some knowledge of German is desirable to do the basic config. The default keyboard layout is German, for starters.

On the mail server side, it is absolutely crucial to get the DNS MX records correct, and not just on your DNS server if you are running one.e.g. My domain registrars' mail servers will accept mail for my domains by defult, and the MX records define them as the definitive servers for that domain, typically set at a priority of 10 or 20 or so.
The admin panel allows me to define email addresses for the domain, mail forwarding, catchall forwarding etc. Some of those settings have very unexpected results however, and can kill all mail for the domain.
Once I had my mail server set up, it was necessary to add DNS name records there for the mail server, and an MX record for the mail server with a lower (numeric) priority than their servers. That way, their mail servers would still accept mail for the domain, but forward it to my server.
Home router also had to be set with static IP and DMZ type forwarding to the server machine.

Hope that helps a bit, and have fun.
14 Apr 2007, 15:31
#5
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Ok. I have followed the tutorials on How To Forge website and everything seems to be working properly but I get this error. Warning it's a long one.

------------------- SMTP -> get_lines(): $data was "" SMTP -> get_lines(): $str is "220 mail.gameitus.com ESMTP Postfix (Ubuntu) " SMTP -> get_lines(): $data is "220 mail.gameitus.com ESMTP Postfix (Ubuntu) " SMTP -> FROM SERVER: 220 mail.gameitus.com ESMTP Postfix (Ubuntu) ------------------- SMTP -> get_lines(): $data was "" SMTP -> get_lines(): $str is "250-mail.gameitus.com " SMTP -> get_lines(): $data is "250-mail.gameitus.com " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com " SMTP -> get_lines(): $str is "250-PIPELINING " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING " SMTP -> get_lines(): $str is "250-SIZE 10240000 " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 " SMTP -> get_lines(): $str is "250-VRFY " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY " SMTP -> get_lines(): $str is "250-ETRN " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN " SMTP -> get_lines(): $str is "250-STARTTLS " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS " SMTP -> get_lines(): $str is "250-AUTH PLAIN LOGIN " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN " SMTP -> get_lines(): $str is "250-AUTH=PLAIN LOGIN " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN " ------------------- SMTP -> get_lines(): $data was "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN " SMTP -> get_lines(): $str is "250 8BITMIME " SMTP -> get_lines(): $data is "250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250 8BITMIME " SMTP -> FROM SERVER: 250-mail.gameitus.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250 8BITMIME ------------------- SMTP -> get_lines(): $data was "" SMTP -> get_lines(): $str is "250 Ok " SMTP -> get_lines(): $data is "250 Ok " SMTP -> FROM SERVER: 250 Ok ------------------- SMTP -> get_lines(): $data was "" SMTP -> get_lines(): $str is "554 : Recipient address rejected: Relay access denied " SMTP -> get_lines(): $data is "554 : Recipient address rejected: Relay access denied " SMTP -> FROM SERVER: 554 : Recipient address rejected: Relay access denied SMTP -> ERROR: RCPT not accepted from server: 554 : Recipient address rejected: Relay access denied ------------------- SMTP -> get_lines(): $data was "" SMTP -> get_lines(): $str is "250 Ok " SMTP -> get_lines(): $data is "250 Ok " SMTP -> FROM SERVER: 250 Ok

Email Error: SMTP Error: The following recipients failed: [email protected]

Now I am not exactly sure what it all means but the Relay access denied seems pretty obvious. Now what exactly do you think I could do about that?

I know that with Mozilla Thunderbird I am able to send messages through but it's not working with postfix for some reason.

Any Ideas?
14 Apr 2007, 16:23
#6
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Whoa do you have logging cranked up 11 or so!! If the mail server and website are on the same server, change the mail transport to PHP and try that. i.e. the mail server should theoretically accept mail from a domain website on 'itself'. There is no point in using SMTP to talk from a website to a mail server on the same machine.
There are a couple of setup issues that could put a spoke in however.
In order for the outside world to be happy with the mailserver, you would need to add a couple of records to the definitive/authoritative name server for your domain - usually at your domain registrar. First a name record for mail.gameitus.com pointing to the IP address you are using for the server. This should be an IP that is visible to the internet - e.g. the external IP of your router, not a non routable Ip address of the machine - e.g. 192.168.0.xxx.
Secondly, a DNS MX record for mail.gameitus.com with a priority that is numerically lower than any other gameitus.com mail server priorities. This flags your server as the chief honcho mail server for the domain.
14 Apr 2007, 19:45
#7
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Ok.

So this means that when I am sending an e-mail to smtp.google.com my mail server connects and then the google server tries to check for a MX record to see if this is a real server? Is that how it goes?

I have not set any MX names up for my mail server yet so google can't check my server is a real server?

Do you have any idea how to set this up? All my MX records point towards googles mail server. should I change this to my own? If so how do I go about finding out or creating my own MX records for my mail server?

This all gets very confusing.

Thanks for all your help Chuckl. I owe you one.
14 Apr 2007, 19:54
#8
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Also if it's any help. I use Zone Edit for my name servers. My registrar is 123reg.com. They both have places in which you can enter MX records but not entirely sure which one I should be using so have added google's MX records to both.

Also my website as you have prob realized is www.gameitus.com
My Zencart is at www.gameitus.com/zencart
14 Apr 2007, 20:11
#9
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

I realised after I posted the last one that I hadn't really stressed the fact that I felt it was important to establish whether your Zen Cart shop could now talk to the local mail server. That would be a very good step 1, as if not, ther's some more config to do on your Ubuntu setup.
i.e. Set mail transport to PHP, send an email from admin, and then check the mail log to see whether it is accepted by Postfix.
Once that is accomplished, we know you have a working shop, and several ways to get the mail out to the world.
And yes, in this day and age mail servers can get very picky about the connections they do and do not receive and accept. Thats why I am so keen to get the mail as far as the Postfix server.
14 Apr 2007, 20:27
#10
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Right.

I am sorry if I seem to be a pain in the *** newbie but I am not sure where to find the mail log.

Also when I set the email delivery setting to PHP it seems to send it via sendmail. Now do I have to change something within the php.ini file to get this to postfix?

Again I apologize for my lack of knowledge.
14 Apr 2007, 20:38
#11
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

No need to apologise for any lack of knowledge. Postfix mail log is called mail.log and hopefully is in /var/log/ along with a whole host of other log files.

When you set to PHP and hit send, do you get the mail sent message in admin? If so, thats a very good sign, and don't worry about sendmail, etc at this stage, not important.

When you set the mail transport to PHP, it uses PHP code in PHPMailer to send the mail from the Apache server, usually as a mythical user called www-data, who is the Apache servers phantom persona to do such things. The question at present is whether Postfix is prepared to accept mail from this ethereal fellow.
14 Apr 2007, 20:45
#12
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Admin?

How would I go about finding that out?

I have never received an email or anything for that matter when I have tried sending them from my web server.
14 Apr 2007, 20:50
#13
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Sorry, I meant Zen Cart admin, under Tools, the send email function there
14 Apr 2007, 21:23
#14
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Ok.

Just found the error log. Have no idea what it all means.

You can view it at http://84.66.109.245/errorlog.txt

I will try your other suggestion as soon as poss.
14 Apr 2007, 21:46
#15
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

OK, we make progress. Postfix looks like it is accepting mail from the Apache server, which is what we wanted to accomplish.

Apr 14 17:00:30 server postfix/qmgr[5290]: 71FA0694062: from=<[email protected]>, size=912, nrcpt=1 (queue active)
Apr 14 21:09:59 server postfix/qmgr[5290]: AA245694068: from=<[email protected]>, size=912, nrcpt=1 (queue active)
Apr 14 21:12:20 server postfix/qmgr[5290]: 71FA0694062: from=<[email protected]>, size=912, nrcpt=1 (queue active)

And Postfix is trying furiously to talk to gmail to pass the mail on, but I suspect that the port 25 block is preventing it.
14 Apr 2007, 21:52
#16
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Well gmail say's that it's port for smtp is 465 or 587 as you can see here

I used to try and send email's with Thunderbird through port 25 and they got blocked but when I started using gmail and used port 587 the e-mails sent without a problem.

I am sure there must be a way in which postfix can send e-mails out through this port so the google server.
14 Apr 2007, 22:06
#17
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

There is indeed, which is our potential next step. Couple of questions first, as consistency becomes important in the near future.

Did you see any mail sent confirmation messages from the ZC admin send email?
Then,
Firstly, if you do a

cat /etc/hosts

from the command line, what does it give you on the 127.0.0.1 line output?

Should be something like

127.0.0.1 localhost something.mydomain.com

Secondly, the mail.gameitus.com name, is that a real name, or an assumption that mail servers are called mail.something?
14 Apr 2007, 22:13
#18
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Well in the 127.0.0.1 output it just said localhost.

Is this wrong. And when I installed postfix I called it mail.gameitus.com.
Not sure if that was right. But I have done some other config since after looking at more tutorials on How to forge.

Maybe I overwrote the host name.
14 Apr 2007, 22:39
#19
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Posts:
717
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

Not the end of the world, however you should edit /etc/hosts at some stage and add the full name of your server after the word localhost ( a space between localhost and the name is good).
e.g. 127.0.0.1 localhost myserver.mydomain.com

There may well be a line below that with the IP address of the machine together with the machine name.
e.g.

192.168.0.1 myserver

and ideally that should be

192.168.0.1 myserver.mydomain.com myserver

None of that is anything other than dotting i's and crossing t's, and can wait till we are done.

There is a file in /etc/postfix/ called master.cf Near the top is a line that should read something like

smtp inet n - - - - smtpd

This tells Postfix that for smtp port 25 it must use the secure authentication daemon. You want to duplicate that line on a new line immediately below that but replace the smtp with the port number 587
i.e.

587 inet n - - - - smtpd

and save the file.

I have also seen comments that uncommenting the line immediately below the smtp line (the one starting submission - remove the #) will do the same thing.

You will then need to restart Postfix,

/etc/init.d/postfix restart

and try sending email from ZC admin, then post the mail log.

We may well have to do some DNS edits and fixup to make everybody happy, but we're getting closer
15 Apr 2007, 10:44
#20
revsie avatar

revsie

New Zenner

Join Date:
Apr 2007
Posts:
23
Plugin Contributions:
0

Re: Home Linux Server - Gmail help -- how to forward through gmail if using postfix

I think this is why people get nervous about using Linux. I enjoy playing around and getting things to work but the other people I know would run a mile. But then again they can't even use the internet properly.

Right, I made all the changes Master Chuckl and I have restarted postfix. I tried to send a mail through admin and it said the email was sent.

Nothing arrived but I have updated the error log that I posted a little while back. http://84.66.109.245/errorlog.txt

Now the error at the bottom looks interesting. I think we are making progress :clap:.

Chuckl you should be called Master Zen. Of the e-mail section anyway.:smile: