View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 1 post ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Fri Feb 20, 2009 10:32 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
It is sometimes useful to be able to use the normal mail command. For example, some tools like smartctl can be configured to send emails on error. If you create a google mail account, you can use postfix to send mail using this google account.

The following assume you are logged in as root.

1. Get a google mail account a gmail.com

2. Install some basic libraries:
Code:
apt-get install libsasl2-2 sasl2-bin libsasl2-modules  procmail


3. Install postfix. This will start the configure. Select the "Internet Site" configuration. For the "Relay Host" enter "smtp.gmail.com:587".
Code:
apt-get install postfix


4. Create the password file for your account. Put the following in /etc/postfix/sasl_passwd:
Code:
smtp.gmail.com:587 YourUserID@gmail.com:YourPassWord


5. Create the hash file with the following command
Code:
cd /etc/postfix
postmap sasl_passwd


6. Secure the passwd files:
Code:
chown root:root /etc/postfix/sasl_passwd*
chmod go-rwx etc/postfix/sasl_passwd*


7. Update the sasl config:
Code:
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf


8. Add the following lines to the bottom of /etc/postfix/main.cf
Code:
## SASL Settings
# This is going in to THIS server
smtpd_sasl_auth_enable = yes
# We need this
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
broken_sasl_auth_clients = yes
smtp_tls_loglevel = 1
smtpd_tls_loglevel = 1
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache
tls_random_source = dev:/dev/urandom
disable_dns_lookups = yes
inet_interfaces = all


9. Restart postfix:
Code:
postfix stop
postfix start


10. Test mail (If it doesn't work, check /var/log/mail.log):
Code:
echo Hello | mail -s Test <emailAddress>


11 (Optional): Fix local email. This allows mail to a local user. Ex. "echo Hello | mail -s Test root":
Code:
chown mail:mail /var/mail
chmod chmod g=rwx,o=rx /var/mail


12 (Optional): Create a forward so local email is sent elsewhere. Log in as the user who's mail will be forwarded. Edit ~/.forward and put in the email where the mail will be forwarded.

I think I captured everything. There was a bit of trial and error setting this up the first time, but I think this captures the necessary steps.

The following link helped me quite a bit:

http://behindmyscreen.newsvine.com/_new ... easy-steps

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu