• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Michele Neylon :: Pensieri

Michele Neylon :: Pensieri

Technology, Marketing, Domains, Thoughts

Logging Email From PHP Scripts

April 27, 2009 by Michele Neylon 2 Comments

This is more a note for myself than anything else …

By default a lot of php scripts will send emails that appear as coming from the Apache user, which makes tracking down a rogue script really annoying and time-consuming.

You end up with entries in the mail logs similar to this one:

Apr 27 18:22:29 servername postfix/qmgr[23581]: 0F53421C1FA: from=<ww******@********me.com>, size=929, nrcpt=1 (queue active)

Which isn’t particularly helpful if you have more than one site (vhost) on a particular server.

Making it a bit saner can be done via a simple addition to the Apache vhost config:

php_admin_value sendmail_path ‘/usr/sbin/sendmail -t -i -f ad*****@****in.tld‘

So now any emails sent from that vhost will reference the email specified instead of the Apache user:

Apr 27 19:40:34 servername postfix/qmgr[2469]: 16A8F21C1FA: from=<ad*****@****in.tld>, size=358, nrcpt=1 (queue active)

There are other additions to Php that can log the path to the script itself, though until such time as someone makes it available for Debian / Ubuntu I don’t really fancy having to compile it in manually

Related Posts:

  • privacy-keyboard-keys
    My Privacy Has Been Sold
  • 538203871_18523271710054922_7382288025725952365_n
    Making Apple and Fig Jam
  • computer-code-screens
    Dodgy WordPress Developer Tactics
  • distance-traveled
    The Irish Postal Service Failed Me!
  • 369584561_1455658008621564_5818380236101618364_n
    Jam and Chutney Season
  • wine-prices
    Wine Is Confusing

Filed Under: apache, Debian, Linux, Open Source, Spam Filtering, Techie :: Techno ::, Ubuntu Tagged With: apache, email, php

Michele is founder and CEO of Irish hosting provider and domain name registrar Blacknight. Read More…

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

dotblog founder

Mastodon

Archives

  • Bluesky
  • Instagram
  • Threads
  • Twitter

Pages

  • About Me
  • About This Site
  • Archives
  • Comments Policy
  • Contact Me
  • Newsletter
  • Privacy

Blogroll

  • My Mastodon
  • Blacknight Blog
  • Damien Mulley
  • Technology.ie Podcast
  • Grandad

Stalking Links

Subscribe to Michele Neylon :: Pensieri

Blogroll

  • Blacknight Blog
  • Damien Mulley
  • Gianni Ponzi
  • Gordon Hudson
  • Grandad
  • My Mastodon
  • Paul Savage – BlackDog SEO
  • Stewart Curry
  • Technology.ie Podcast
  • Tom Doyle

Sites

  • Business Travel Tips
  • Discount Coupon Codes
  • Domain News
  • Fat.ie – my diet blog
  • Film Posters
  • Film Reviews
  • Films
  • Free Desktop Wallpapers
  • Irish Blogger Discussion Forum
  • Irish Stamps
  • Movie Trailers and News
  • Paste.ie

Footer

Site hosted in Ireland by Blacknight - Content copyright Michele Neylon

Copyright © 2026 · Magazine Pro on Genesis Framework · WordPress · Log in