2 msgfilter not being called
5 msgpostfix 'delayed' delivery
6 msgBackscatter problem with relay host
6 msgRe: [dkim-milter-discuss] dkim-milter: 'X-DKIM'...
3 msgSpam/Virus filter ONLY for outbound mail?
19 msgGreylisting Query
3 msgQuick queue statistics question
7 msgTesting Cyrus SASL without a Postfix interface
4 msgSpam quarantine management addon for Postfix???
1 msgConfiguring internal distributing mail list ( a...
1 msgRe: Problem using Postfix with LDAP using STARTTLS
7 msgHow to avoid 'BCC' returned?
3 msgPostfix and dkim-milter problem
5 msgallowing a mail to a mailid from a specific ip ...
15 msg[patch] 'post-install' has forgotten to read da...
6 msgPostfix 2.5.0 stable release available
5 msgGuidance on my config
5 msgExtracting bounce messages from the outbound queue
6 msg.forward file crashes and corresponding core du...

Solved (was Re: Relay question)
\ Matt Walsh (24 Jan 2008)

Subject:Solved (was Re: Relay question)
Group:Postfix-users
From:Matt Walsh
Date:24 Jan 2008


 

Ok, I've fixed my problem.

Rather than have my php scripts relay from one server to another, I have
them simply do it via an SMTP socket request. At the risk of not being
germane to Postfix, here's the code, FWIW:

(this uses 'Mail' and 'Mime' from Pear)

function send_out_mail($from, $subject, $html_body, $to)
{ $host = MAIL_SERVER_HOSTNAME;
$crlf = "\n";

// note that Bcc / cc must be in both the headers AND the send() call
$headers = array (
'From' => $from,
'To' => $to,
'Date' => date("r"),
'Subject' => $subject);

$mime = new Mail_mime($crlf);
$mime->setTXTBody(strip_tags($html_body));
$mime->setHTMLBody($html_body);

$total_body = $mime->get();
$headers = $mime->headers($headers);

$params = array (
'host' => $host,
'auth' => false);

$params['localhost'] = hostname();

$smtp = Mail::factory('smtp', $params);
$send = $smtp->send($to, $headers, $total_body);

if (PEAR::isError($send))
{ echo send->getMessage();
return 0;
}
else
{ return 1;
} }




On Jan 23, 2008 3:15 PM, Matt Walsh <walshes> wrote:

> Howdy:
>
> I run a small website with a small cluster of machines, all on the same
> LAN.
>
> One machine runs Postfix, and serves as my inbound/outbound email MTA for
> ALL machines on the LAN.
>
> I've got said machine configured for a number of things, including DKIM,
> DomainKeys (using DK-milter), and SPF.
>
> But sometimes other machines on the cluster want to send out email. This
> is done programmatically from a PHP script.
>
> Because I'm somewhat lazy, and because it seemed to work, I just left
> those machines with the default sendmail stuff but configured the "Smart"
> relay host to point to my Postfix mail server (using the 'DS' sendmail
> setting).
>
> This works.
>
> Almost, that is.
>
> I've noticed that the mail from the relayed machines does not have my
> DKIM/Domain Keys header stuff.
>
> In fact as I look at the messages I see that in fact, the messages are
> relayed in the purest sense of the word. It's just as if I sent a message
> from one host to my Postfix server. I can see the SpamAssasin results and
> everything. That's probably why the DKIM/Domain Keys business is not
> happening - that must only happen on messages that are originated on the
> Postfix server.
>
> So, I guess what I *really* want is a way to just have all my servers use
> my Postfix server 'directly' as a remote server, not as a relay.
>
> Or, some way to have the desired effect of making relayed messages look
> just like originated messages - with DKIM/Domain Keys and all.
>
> Any ideas?
>
> --Matt
>
>
>
>



© 2004-2008 readlist.com