Re: Emailing via mail(), secondary servers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Manuel Lemos wrote:
>>
>> No, not directly, but that hardly seems to matter as the original post
>> asked about relaying.
>
>
> You do not seem to be paying attention. The original post asked
> explicitly about overriding relaying. Read again.
>
>
>> Problem 2
>> You can't override the relaying server ip in the mail() function.
>
>

I read that as "I want to put in a specific relaying mail server IP but I can't."

IMHO, the original post wanted to try one relaying server, then if it failed, try another (or possibly directly send the message). Which would mean changing the 'relaying server'. Technically, all SMTP servers you connect to are the same no matter whether it relays or accepts for 'local' delivery. You still just hand off the message and let the remote SMTP server deal with delivery.

>
> When you use sendmail, it does not relay messages in any intermediate
> SMTP server. This is what the Paul Smith seems to want, but the mail
> function does not does that for him.
>
>
>> You could always set up direct delivery by looking up the MX server
>> for the e-mail address and using the 'smtp' Mail type. Or you could make
>
>
> It is not that easy. I will let you figure why as your homework! ;-)
>


Actually, that's exactly what an SMTP sending program does. Look up the MX record in DSN and send to that server directly. If it fails, it tries the next MX server.

>
>> your own Mail_SMTP_Direct class which wraps around Mail_SMTP and post
>> it back to PEAR for others use.
>
>
> Are you kidding me? Why would I bother to develop something to work with
> a PEAR package that I do not use, when I already have a package that
> does that for me since several years ago?
>

This is mostly just preference. I don't know why everyone who uses phpclasses gets so defensive when I suggest a PEAR class. I'm just suggesting alternatives that I use myself and that I know work well.

I use PEAR because it has a centralized and robust error reporting mechanism, adheres to high coding standards, is actively tested and maintained by many people, is highly re-usable and tries not to duplicate code, and many other reasons.

Before you get your back up, I'm not saying that the stuff on phpclasses doesn't have these features, I'm just saying that's why I use PEAR. If you don't agree, fine.

> Furthermore, this package that I recommended provides a direct
> replacement to the mail() function as I mentioned. So the users do not
> have to figure how use PEAR packages to solve their problem.
>
> They just replace calls to the original mail() functions calls in their
> scripts by calls to smtp_mail() which is the replacement provided by the
> package that I suggested.
>

Yes, a drop-in replacement is nice.

Here's a proof of concept for you.
http://www.reversefold.com/~papercrane/smtp_direct

I've implemented the smtp_direct class I spoke of earlier. It's not 100% tested and is not yet fully PEAR compliant, but I'll propose it to PEAR for inclusion. Here's four simple steps to get it running (2-3 if you already have PEAR):
1) Get PEAR installed
-On Linux, type this in as root:
lynx -source http://go-pear.org/ | php
-For more information, or for Windows instructions, see:
http://pear.php.net/manual/en/installation.getting.php
2) Get the Mail and Net_DNS packages installed
pear install Mail Net_DNS
3) Download smtp_direct.phps from the above URL, copy it to your PEAR's Mail sub-directory. Rename it to smtp_direct.php.
4) Use the simple code in send.phps to get started.


--
paperCrane <Justin Patrin>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux