how can I see the emails sent by my web server ?
They are actually sent through a php script. Is there a way to keep track of them ?
ps. I'm using Ubuntu 10 (and 9) and Lighttpd
There are many possibilities, all very much dependent on the architecture of your system:
As I said, it all depends on your system, and you don't tell us anything about it.
If you are looking for something to help you manage your emails and have some reports as to the status of those emails, take a look at PostageApp.
It's essentially a layer in between your app and SMTP and gives you a better idea of where emails are going, if and why they have been rejected, and you can even create templates to customize your content.
We have some documentation on sample PHP projects, so definitely check it out and let me know if it works out for you.
(Full Disclosure: I am the Product Manager for PostageApp.)
Did you see Amazon's announcment today about Simple Email Service?
Excerpt: "Amazon SES provides useful statistics about your sending activities. With a simple query, you can quickly obtain vital statistics such as volume sent, bounces and complaints."
No matter how the emails are sent, the must use a MTA (Mail Transfer Agent) service. To keep track of the emails sent, go to the logs!
If it's a Linux server, you can use mailq or check the postfix queue. Same thing if you're using Sendmail.
Another thing to watch out is the "lovely" perl scripts that often get uploaded to out of date third party CMS installs. These often have their own SMTP engines which avoid the local mail log. Fortunately this is relatively easy to stop with iptables:
# Allow the root user to initiate outbound connections to port 25 iptables -A OUTPUT -m owner --uid-owner root -p tcp --dport 25 -j ACCEPT # Allow the mail user to initiate outbound connections to port 25 # This presumes your mail server is running as mail iptables -A OUTPUT -m owner --uid-owner mail -p tcp --dport 25 -j ACCEPT # Allow anyone to connect to port 25 on localhost iptables -A OUTPUT -p tcp -d 127.0.0.1 --dport 25 -j ACCEPT # Allow anyone to connect to local relay server iptables -A OUTPUT -p tcp -d relay.example.com --dport 25 -j ACCEPT # Block all other outbound connections to port 25 iptables -A OUTPUT -p tcp --dport 25 -j REJECT
This will force all email to be sent through localhost or a local relay, and only the mail user and root user will be able to send mail outbound. This presumes you are running Linux, and that the ipt_owner module is avilable.
Also, there is the mail header patch for php here which will put the name of the script sending the mail in the headers. As far as I'm concerned it should be part of the core PHP, but unfortunately, it's not.