views:

331

answers:

1

I run a webserver on debian lenny. How to setup postfix to send emails to users for user registration, forgot password? How to configure the system?

I don't want the system to receive any emails from outside world, including user reply.

A: 

The setup and configuration of a mail server is outside the scope of stackoverflow, I guess, since it involves various kinds of system administration tasks (like setting up a Reverse IP for the server). Just use Google to find a bunch of tutorials about setting up a Postfix server on Debian.

But that may be more effort than necessary. Have you thought about using SMTP to deliver the outgoing mails to an existing SMTP server on an external machine?

If setting up a mail account for the outgoing mails on an existing mail server is an option for your project, than coding the SMTP sending in your web application will be far less effort than setting up a new mail server:

The SMTP part is almost trivial (e.g. in Python: http://docs.python.org/library/smtplib.html#smtp-example). Only problem is, depending on the external SMTP server, you'll have to authenticate first with the server before you're allowed to send mails via SMTP. Often this is implemented as SMTP-after-POP, so you'll have to provide the credentials of the mail account first via POP3. But this is trivial to implement as well (again in Python: http://docs.python.org/library/poplib.html#pop3-example):

import poplib,smtplib

recipient="your.customer@whereever"
msg="Subject: Welcome\n\nWelcome...\n"
sender="[email protected]"
pass="xyz"

pop3=poplib.POP3('mail.example.org')
pop3.user(sender)
pop3.pass_(pass)
pop3.quit()

smtp=smtplib.SMTP('mail.example.org')
smtp.sendmail(sender, recipient, msg)
smtp.quit()
flight