Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Newbe please help

1 view
Skip to first unread message

Ralph

unread,
Dec 24, 2006, 5:34:13 AM12/24/06
to
Hi

Frankly I don't know anything about postfix. I have no idea how MTA or MUA works.

Background:
I'm developing some PHP code that uses mail function. I'm doing all the work on my development
server at home that is on the dynamic IP address.

What I need to do:
I need to install and configure postfix to work as a rely. so i can send emails using my account
lets say on gmail or any other SMTP server.

Could you point me to the article describing how can I configure it with Postfix?

Thank you very much.

--

Ralph

Greg Hackney

unread,
Dec 24, 2006, 2:47:33 PM12/24/06
to
Ralph wrote:

> I need to install and configure postfix to work as a rely. so i can send
> emails using my account lets say on gmail or any other SMTP server.

Be aware that in using Gmail as a relay, it will modify any FROM address
in the mail message, to be your Gmail address.

But here's how you do it:

==============
1. Make sure that your version of Postfix supports SASL:

Find out where you Postfix directory is:

# postconf daemon_directory
daemon_directory = /usr/libexec/postfix

See if the Postfix smtp file is linked with the SASL library. It
should look something like this:

# ldd /usr/libexec/postfix/smtp | grep sasl
libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x009b5000)

If the library isn't listed, you'll have to find a version that has it,
or compile it from scratch.


==============
2. Create a file called: /etc/postfix/sasl_passwd

The contents should contain your Gmail account info in this format:

gmail-smtp.l.google.com myl...@gmail.com:mypassword
^
lower case L


Run these commands:
chown 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd

==============
3. Add these configurations to /etc/postfix/main.cf:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_type = cyrus


============
4. Run the command postfix reload

At this point in time, any mail addresses to *@gmail.com
should be delivered via gmail-smtp.l.google.com using
your account for a login.


=============
If you want ALL outbound email to route via gmail.com, use
step "5a". If you want only certain domains to route via
gmail.com, use step "5b" instead.


5a. ALL outbound email to route via gmail.com

Add this to the main.cf file:

relayhost = gmail-smtp.l.google.com

Run the command: postfix reload


5b. Only certains domains route via gmail.com

Add this to the main.cf file:

transport_maps = hash:/etc/postfix/transport

Add any domains to /etc/postfix/transport that you want to
route via gmail.com:

domain1.com smtp:gmail-smtp.l.google.com
domain2.ccom smtp:gmail-smtp.l.google.com

Run the commands:

postmap /etc/postfix/transport
postfix reload


Send some test mail, and watch the postfix log file.
For example:

tail -f /var/log/maillog

--
Greg

Ralph

unread,
Dec 24, 2006, 3:03:10 PM12/24/06
to

What should I put in mydestination, myorgin, mydomain, myhostname?


--

Ralph

Greg Hackney

unread,
Dec 24, 2006, 3:10:43 PM12/24/06
to
Ralph wrote:

> What should I put in mydestination, myorgin, mydomain, myhostname?

Take a look at the output of: man 5 postconf | less

Each one of those is described there.

--
Greg

Ralph

unread,
Dec 24, 2006, 3:18:42 PM12/24/06
to
I did read that but what should i put there if i have dynamic IP and don't have a domain?

--

Ralph

Greg Hackney

unread,
Dec 24, 2006, 4:35:37 PM12/24/06
to


Make something up.

You said you were just doing development work. Besides, Gmail will
replace your FROM address and domain name anyway.

--
Greg

Ralph

unread,
Dec 24, 2006, 4:55:03 PM12/24/06
to
Thank you. That's what i wanted to hear:)

--

Ralph

0 new messages