0

Under transport configuration of Exim I have added the X-Report-Abuse header. This works if an email is sent from a mail client but not from an PHP application.

remote_smtp:
      driver = smtp 
      dkim_domain = ${lc:${domain:$h_from:}} 
      dkim_selector = x 
      dkim_private_key = /etc/exim/dkim.private.key 
      dkim_canon = relaxed
      headers_add = X-Report-Abuse: Please report any abuse text

Where I can add the same line in Exim for have the same header added only to mail sent from Wordpress, or PHP applications?

I tried to add this header line under routers configuration, but the issue is that incoming mail to my email domain address should not have the X-Report-Abuse line as email are not sent from my server are received from others.

If I add as below:

vmail_aliases:
  driver = redirect
  allow_defer
  allow_fail
  data = ${lookup{$local_part}lsearch{/etc/vmail/$domain/aliases}}
  domains = dsearch;/etc/vmail
  qualify_domain = $domain
  pipe_transport = address_pipe
  retry_use_local_part
  headers_add = X-Report-Abuse: Please report any abuse text

dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  headers_add = X-Report-Abuse: Please report any abuse text
  no_more

also external email received to my email address will report the X-Report-Abuse this has no sense as if I want report a spam email received seems the abuse report should sent to me but I never sent that email, I received.

Thank you for the help.

Maybe I need set headers on PHP.ini ? http://php.net/manual/en/function.mail.php

I want add an X-Report-Abuse: TEXT with all mail generated from sendmail / PHP.

How can I set this on PHP.ini for be default for all mail? Need configure sendmail?

Marco
  • 39
  • 13
  • Should I add X-Report-Abuse header in PHP or Exim? – Marco Mar 30 '18 at 10:02
  • Maybe I need add a control if X-Mailer is PHPMailer than add header X-Report-Abuse? How to do? https://tttwrites.wordpress.com/2014/06/22/altering-e-mail-return-path-with-exim4-and-php-mailer-in-wikitech-labs/ – Marco Mar 30 '18 at 10:11
  • Which router is exim using to deliver mail to recipient of the php mail? Check this with `exim -bt -v test@testdomain.com` – Jim U Mar 30 '18 at 14:41
  • router = vmail_deliver, transport = vmail_delivery – Marco Mar 30 '18 at 14:49
  • Remove `headers_add` from `vmail_delivery` and `vmail_aliases` and restart exim. Now run `exim -bt -v test@testdomain.com` on an email address that you *DO* want to add `X-Report-Abuse`. What router is it using? – Jim U Mar 30 '18 at 15:04
  • I commented all headers_add restarted Exim. I sent the SSH command and result is the same router = vmail_deliver, transport = vmail_delivery – Marco Mar 30 '18 at 15:25
  • I don't know what your 'vmail_deliver' router looks like, but it's matching whatever the recipient address is. Please post 1) the configuration for 'vmail_deliver', 2) the recipient's email address that your PHP program is sending mail to, and 3) whether or not you want the abuse header added to mail sent to this address. – Jim U Mar 30 '18 at 18:37
  • Alternatively -- as you suggested above -- you should be able to add the header to your PHP script with the [mail function](http://php.net/manual/en/function.mail.php). – Jim U Mar 30 '18 at 19:17
  • 1) I do not know where and how configuration vmail_deliver can be. 2) there different email and PHP application like Wordpress, Osticket, the live chat. I want all outgoing email have the flag Abuse Report. 3) I just want incoming email from other address not of my VPS and domain has not this mine flag. – Marco Mar 30 '18 at 22:46
  • Find vmail_deliver with `cd /etc; grep -R 'vmail_deliver'` – Jim U Apr 02 '18 at 12:47
  • Result: `exim/exim.conf:vmail_deliver: exim/exim.conf: transport = vmail_delivery exim/exim.conf:vmail_delivery:` – Marco Apr 02 '18 at 13:01
  • Please post 1) the configuration for 'vmail_deliver' that you just found, 2) the recipient's email address that your PHP program is sending mail to, and 3) whether or not you want the abuse header added to mail sent to this address – Jim U Apr 03 '18 at 13:42
  • https://pastecode.xyz/view/7c621b60 is not a specific email address. I want add header for all email sent (and only sent) from SMTP email client and PHP app like wordpress. OsTicket, live chat all PHP script. Thanks. – Marco Apr 03 '18 at 15:02
  • right. your outgoing mail shouldn't be matching your virtual domains. outbound mail should fall through the vhost* routers to a router that delivers via domain search or to your isp's smtp server (a smarthost). That's where you put the `header_add`. – Jim U Apr 03 '18 at 23:48
  • I do not know what and how to do. – Marco Apr 04 '18 at 10:06

0 Answers0