X-Report-Abuse on mail sent from SMTP PHP, sendmai

2019-08-26 06:46发布

问题:

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?