Email notifications - configure "from address"

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
s9yrookie
Regular
Posts: 5
Joined: Wed Nov 25, 2015 1:21 pm

Email notifications - configure "from address"

Post by s9yrookie »

Hi all,

My linux distro (Raspbian) did not come with sendmail installed, so I've gone by without email notifications for some time. Finally got around to fixing it and now my blog generates outgoing emails which my ISP is happy to pass on. Yeay!

Only problem is I would like to customise the email's from address. Currently the apache user's name is appearing on the email headers:

Return-Path: <www-data@aupcgroup.com>
From: www-data <www-data@aupcgroup.com>

Note though I own the domain and have correctly set up MX record, the server is not configured to accept incoming smtp traffic. Instead I would rather set the return path / reply to address to my gmail account. I would also like to change the from address to something other than www-data (maybe admin@aupcgroup.com).

What's the easiest way to achieve this?

TIA
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Email notifications - configure "from address"

Post by Timbalu »

In the php.ini file by
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
OR in its "sendmail_path" directive by adding the "-r" option, eg "-r admin@example.org"
OR use mailto -f admin@example.org in the php mail function itself, eg

Code: Select all

mail('to@example.org', 'subject', 'message', $headers, '-f admin@example.org');
In your case I would try to play with the php.ini.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
s9yrookie
Regular
Posts: 5
Joined: Wed Nov 25, 2015 1:21 pm

Re: Email notifications - configure "from address"

Post by s9yrookie »

Wow, thanks for the super quick response.

Actually I didn't realise I left the blog's email address blank in the config, hence the defaults.

Entering a value has set the From and Reply To headers appropriately.

Return path unchanged. I hate messing with things I don't understand, so I think I'm happy everything looks like it works (though I get warnings in Gmail about the authenticity of the sender).

Will definitely look into this *later* :)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Email notifications - configure "from address"

Post by Timbalu »

I supposed you had done that already...
Did you add it to configuration - general settings globally and also in your personal preferences?
Try that, if not.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
s9yrookie
Regular
Posts: 5
Joined: Wed Nov 25, 2015 1:21 pm

Re: Email notifications - configure "from address"

Post by s9yrookie »

Timbalu wrote:I supposed you had done that already...
Did you add it to configuration - general settings globally and also in your personal preferences?
Try that, if not.
LOL, I supposed I had already done that also... turns out I set an email address for the primary user / administrator but left the other one blank. My bad. To add to the confusion I found out my IP was on an email blacklist, so I could never tell if my config was bad or if smtp traffic was being rejected.

Spent about 3 days figuring out how to get outgoing email to work. Even now I'm not sure about every single configuration option (I'm talking about Sendmail here). I've read countless articles about how to set up specific features, seems everyone has slightly different needs/way of doing things.

Not sure if this is the best place to ask but I will, Is there a good guide to configuring sendmail on Linux? Something that spells things out step by step? I relied on this http://www.linuxhomenetworking.com/wiki ... il_Servers - very in depth but parts skim over some details and it's probably more useful to someone who knows what they are doing.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Email notifications - configure "from address"

Post by Timbalu »

So you say you are using Serendipity with a RasPi Server, with Sendmail and Apache, at home and behind a dynIP DDNS?
I can't help with Sendmail, but would recommend to go with Postfix instead. Its much more modern.... and a little easier to understand. On RasPi there would be even more slim alternatives for Server and MTA recommended, I assume.
You will still have these blacklist (or reject) things, since there are some server (ISP) admins (like me), who strictly disallow DynIP mail transfers. Its most probably Spam. I want my MTA to only except mail from verified senders, which is not possible with dynIP senders. And I can say to remember, I never had a valid sender with DynIP in the last decade ++. :)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
s9yrookie
Regular
Posts: 5
Joined: Wed Nov 25, 2015 1:21 pm

Re: Email notifications - configure "from address"

Post by s9yrookie »

Timbalu wrote:So you say you are using Serendipity with a RasPi Server, with Sendmail and Apache, at home and behind a dynIP DDNS?
You're correct on points 1-5, my ISP has allocated me a static IP address. Now I did read somewhere that for things to work the ISP needs to set correct PTR / reverse dns lookup. dig shows PTR record set to myip.static.tpgi.com.au, which I'm not sure is correct.
Timbalu wrote:I can't help with Sendmail, but would recommend to go with Postfix instead. Its much more modern.... and a little easier to understand. On RasPi there would be even more slim alternatives for Server and MTA recommended, I assume.
Thanks for the recommendation. Raspbian is a Debian/Ubuntu based distro that's tailored to work with the RasPi ARM cpu, I imagine most packages available to Debian are also available to Raspbian. I'll definitely keep Postfix in mind for future projects.
Timbalu wrote:You will still have these blacklist (or reject) things, since there are some server (ISP) admins (like me), who strictly disallow DynIP mail transfers. Its most probably Spam. I want my MTA to only except mail from verified senders, which is not possible with dynIP senders. And I can say to remember, I never had a valid sender with DynIP in the last decade ++. :)
The blacklist was the SORBS SPAM database. In any case I've setup Sendmail to use my ISP's smtp server as a smarthost. Outgoing connection is authenticated and my ISP will relay to destination. It's working for dest I've tested so far. This is similar to configuring Outlook email client to send mail through ISP. Is this setup ok? Maybe you could try subscribing to a comment at my blog to test if the mail gets through your server?
http://www.aupcgroup.com/blog/index.php ... sting.html

Ian, thanks again for your input. You know your stuff, and I think I'll have learn just a bit. :D
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Email notifications - configure "from address"

Post by Timbalu »

s9yrookie wrote:In any case I've setup Sendmail to use my ISP's smtp server as a smarthost. Outgoing connection is authenticated and my ISP will relay to destination. It's working for dest I've tested so far.
Well, in that case its not getting a dynIP and my concerns regarding that should not be your problem.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply