Estou executando um servidor Centos 6.4 com Directadmin e Exim instalado. Estamos usando a filtragem de saída junto com o Spamexperts.com. De alguma forma, quando eu envio e-mail com o PHP, o remetente do envelope está sendo reescrito para o usuário Directadmin padrão. Não consigo descobrir o porquê.
O script PHP:
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//mail($to, $subject, $message, $headers, "[email protected]");
mail($to, $subject, $message, $headers);
?>
Ao executar o código PHP acima, o Exim registrará o seguinte:
2014-03-19 10:32:29 1WQCrN-000511-4Z <= [email protected] U=userX P=local S=446 T="the subject" from <[email protected]> for [email protected]
2014-03-19 10:32:29 1WQCrN-000511-4Z ** [email protected] F=<[email protected]> R=spamexperts_smarthost_router T=spamexperts_smarthost_transport: SMTP error from remote mail server after MAIL FROM:<[email protected]> SIZE=1483: host smtp.antispamcloud.com [46.165.209.5]: 550-Verification failed for <[email protected]>\n550-Previous (cached) callout verification failure\n550 Invalid sender <[email protected]>
2014-03-19 10:32:29 1WQCrN-000516-I1 <= <> R=1WQCrN-000511-4Z U=mail P=local S=1544 T="Mail delivery failed: returning message to sender" from <> for [email protected]
2014-03-19 10:32:29 1WQCrN-000511-4Z Completed
2014-03-19 10:32:32 1WQCrN-000516-I1 => [email protected] F=<> R=spamexperts_smarthost_router T=spamexperts_smarthost_transport S=1586 H=smtp.antispamcloud.com [46.165.209.5] X=TLSv1:DHE-RSA-AES256-SHA:256 C="250 OK id=1WQCrW-00033I-Lu"
2014-03-19 10:32:32 1WQCrN-000516-I1 Completed
A parte crítica é a parte em negrito:
2014-03-19 10:32:29 1WQCrN-000511-4Z & lt = = [email protected] U = userX P = local S = 446 T="o assunto" de < [email protected]> para [email protected]
Quando eu mudo o script PHP para:
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers, "[email protected]");
//mail($to, $subject, $message, $headers);
?>
O log do Exim mostra o seguinte:
2014-03-19 10:48:09 1WQD6X-000569-IR <= [email protected] U=userX P=local S=442 T="the subject" from <[email protected]> for [email protected]
2014-03-19 10:48:13 1WQD6X-000569-IR => [email protected] F=<[email protected]> R=spamexperts_smarthost_router T=spamexperts_smarthost_transport S=459 H=smtp.antispamcloud.com [198.7.58.154] X=TLSv1:DHE-RSA-AES256-SHA:256 C="250 OK id=1WQD6P-0002nu-00"
2014-03-19 10:48:13 1WQD6X-000569-IR Completed
Veja que a parte crítica não está sendo reescrita:
2014-03-19 10:48:09 1WQD6X-000569-IR & lt = = [email protected] U = userX P = local S = 442 T="o assunto" de < [email protected]> para [email protected]
Informações adicionais:
despojado exim.conf
[...]
syslog_duplication = false
local_from_check = false
local_sender_retain = false
untrusted_set_sender = *
[...]
# TRUSTED USERS
# OPTIONAL MODIFICATIONS:
# if you must add additional trusted users, do so here; continue the
# colon-delimited list
#trusted_users = mail:majordomo:apache:diradmin:${readfile{/etc/exim.users}}
trusted_users = mail:majordomo:apache:diradmin:userX:
trusted_groups = apache:userX
######################################################################
# REWRITE CONFIGURATION #
######################################################################
begin rewrite
#* [email protected] F
# There are no rewriting specifications in this default configuration file.
######################################################################
# ROUTERS CONFIGURATION #
# Specifies how remote addresses are handled #
######################################################################
# ORDER DOES MATTER #
# A remote address is passed to each in turn until it is accepted. #
######################################################################
# Spamexperts
begin routers
spamexperts_smarthost_router:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
condition = "${perl{check_limits}}"
transport = spamexperts_smarthost_transport
route_list = $domain smtp.antispamcloud.com::587
no_more
# Remote addresses are those with a domain that does not match any item
# in the "local_domains" setting above.
# This router routes to remote hosts over SMTP using a DNS lookup. Any domain
# that resolves to an IP address on the loopback interface (127.0.0.0/8) is
# treated as if it had no DNS entry.
#lookuphost:
# driver = dnslookup
# domains = ! +local_domains
# ignore_target_hosts = 127.0.0.0/8
# condition = "${perl{check_limits}}"
# transport = remote_smtp
# no_more
[...]
# Spamexperts
begin transports
spamexperts_smarthost_transport:
driver = smtp
hosts_require_tls = smtp.antispamcloud.com
# Spam Assassin
spamcheck:
driver = pipe
batch_max = 100
command = /usr/sbin/exim -oMr spam-scanned -bS
current_directory = "/tmp"
group = mail
home_directory = "/tmp"
log_output
message_prefix =
message_suffix =
return_fail_output
no_return_path_add
transport_filter = /usr/bin/spamc -u ${lookup{$domain}lsearch*{/etc/virtual/domainowners}{$value}}
use_bsmtp
user = mail
# must use a privileged user to set $received_protocol on the way back in!
[...]
* Notas extras:
- local_from_check = false, local_sender_retain = false e untrusted_set_sender = * não tem efeito.
- userX é o usuário / revendedor do Directadmin
- Quando eu habilito a parte de reescrita do exim, o e-mail será entregue, mas é claro que todo e-mail terá um caminho de retorno de < [email protected]> o que não é desejável. *