Forum Moderators: coopster

Message Too Old, No Replies

Php mail() emails not getting signed by postfix

         

roycerus

2:46 pm on Aug 27, 2008 (gmt 0)

10+ Year Member



We are trying to install dk-milter / dkim with postfix to create a mail server. When emails are sent directly from the command prompt the domain key works fine. But when we try to send out emails using our php script the emails don't get signed.

I am copy pasting the main.cf [postfix] php.ini and the code snippet here:


CODE SENDING THE EMAIL
----------------------

<?php
$to = "myemail@gmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$headers = "From: my@MYDOMAIN.com\r\n" .
"X-Mailer: php";
if (mail($to, $subject, $body, $headers)) {
echo("<p>Message sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>


POSTFIX MAIN.CF
-------------------

#milter_default_action = accept
smtpd_milters = inet:localhost:1025
non_smtpd_milters = inet:localhost:1025

default_destination_concurrency_limit=20
default_destination_recipient_limit=20
default_process_limit=400
smtp_mx_session_limit=100
smtpd_client_connection_count_limit=100
smtp_destination_concurrency_limit = 5
smtp_destination_recipient_limit = 25
maximal_backoff_time = 4000s
minimal_backoff_time = 2000s
qmgr_message_active_limit = 200000
qmgr_message_recipient_limit = 200000
bounce_queue_lifetime=5m
maximal_queue_lifetime=1h
smtpd_timeout = 300s

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = mail.MYDOMAIN.com
mydomain = MYDOMAIN.com
myorigin = $mydomain
inet_interfaces = $myhostname, localhost
mydestination = $myhostname, localhost.$mydomain, localhost
virtual_transport = virtual
virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /var/spool/postfix/virtual
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_uid_maps = static:500
virtual_gid_maps = static:500
local_recipient_maps = $virtual_alias_maps
unknown_local_recipient_reject_code = 550
mynetworks = $config_directory/mynetworks

smtpd_sasl_type = dovecot
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/

debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES


PHP.INI
--------

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; sendmail_path = /usr/sbin/sendmail -t -i
sendmail_path = /usr/sbin/sendmail.postfix -t -i

; 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 =



HEADERS OF THE EMAIL SENT TO YAHOO
----------------------------------------------------

From my@MYDOMAIN.com Wed Aug 27 07:32:02 2008
Return-Path: <apache@MYDOMAIN.com>
Authentication-Results: mta223.mail.re3.yahoo.com from=; domainkeys=neutral (no sig)
Received: from 209.216.205.173 (EHLO mail.MYDOMAIN.com) (MY.IP.ADD.RESS)
by mta223.mail.re3.yahoo.com with SMTP; Wed, 27 Aug 2008 01:04:32 -0700
Received: by mail.MYDOMAIN.com (Postfix, from userid 48)
id 253EC6903D4; Wed, 27 Aug 2008 07:32:02 +0530 (IST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=MYDOMAIN.com;
s=mail; t=1219802522; bh=ldKgEe724xH2qXy7es5g/t59sIUgFBIqyAWYZs2SSw
Y=; h=To:Subject:From:Message-Id:Date; b=01LRyFea6xFRGz6yr5FFqDBV3o
b5g1gZPzBnfsGYsLsPAVbQDKFXT4P7wsrKK6ErNBQkkruufjIVT8KEmaO1n/DkFGWRP
lEmgnhmiufC2kih+S2pepoQsr6j2+J3ZRLFqk/2TBySOXRkyfi1m+JudmfBKzzmKGp5
3gO1Z3cVTbs=
To: MYID@yahoo.com
Subject: Hi!
From: my@MYDOMAIN.com
Message-Id: <20080827020202.253EC6903D4@mail.MYDOMAIN.com>
Date: Wed, 27 Aug 2008 07:32:02 +0530 (IST)
Content-Length: 18

eelixduppy

10:38 pm on Sep 8, 2008 (gmt 0)



Have you gotten anywhere with this yet?

roycerus

5:26 am on Sep 9, 2008 (gmt 0)

10+ Year Member



Nope... we had to drop the idea and just go with the SPF implementation.