Re: Setting PHP to use SMTP

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

 



On Sun, October 15, 2006 10:25 pm, Dave M G wrote:
> In an effort to make emails that I send through PHP scripts not be
> mistaken for spam, it seems that one thing I need to do is make sure
> that the emails are sent via SMTP.

I doubt that this is going to matter much...

The emails ALL end up going through SMTP sooner or later anyway.

It's a question of whether you re-invent the wheel to connect, use an
existing PHP package to connect, or use PHP to interface to an
existing non-PHP package to connect.

You'd only need to connect within PHP to SMTP for performance / volume
sending, not just making it look not like spam.

> Right now, if I check my PHP generated emails with Spamassassin, it
> says:
>
> -0.0 NO_RELAYS Informational: message was not relayed via SMTP

I think what it's REALLY saying is that the email went from your
server to itself, and did not bounce through a whole bunch of SMTP
relays along the way...

If you send the email to somebody else, it's gonna hit more SMTP
relays along the way.

If it's hitting a *lot* of SMTP relays, it's a sign that somebody is
forging the SMTP relay path to obscure their "trail" and they are a
spammer.

> It's not deducting points, but I think the fact that it mentions it
> indicates I might be better off using SMTP.

I don't think you are correctly interpreting the basic premise of
NO_RELAYS

> Looking at phpinfo, it says this about my PHP/SMTP settings:
>
> sendmail_from no value no value
> sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
> SMTP localhost localhost
>
> I take this to mean that I don't have a default "from" address, but
> that
> it knows where my SMTP server is.

You should have EITHER sendmail_path or SMTP set up, not both.

I don't even know what PHP is gonna do when you set up both...

What you've done is this:
"Here, use sendmail to send email.  Here, use SMTP to send email"

> However, the last variable, where it's set to "localhost", is not so
> clear to me. Does this mean PHP is using the SMTP server on localhost?
> Does this need to be changed in order for PHP to actually send via
> SMTP
> since it doesn't seem to be doing so now?

I think you'd need to turn off the sendmail_path.

But then don't be surprised if email doesn't go out at all if you
haven't configured SMTP on localhost to actually send/receive email.

And if you start doing that, make real sure you've locked it down so
you don't end up being an open relay and getting on everybody's
blacklist -- That will get you a zillion points deducted instead of
whatever miniscule SMTP bouncing count it's in the -0.0 you are
seeing.

> My virtual hosting service is the kind where I have two IP addresses,
> and I can add as many domain names as I want to my account. Does that
> mean that if I set a default email address in "sendmail_from" that it
> will apply to all my domains? Is there a way to localize the setting
> on
> a domain by domain basis? Or is this a question I need to take to my
> hosting service provider?

All depends how they are loading in php.ini and the PER_DIR/PER_INI
rules of the settings you want to change...

> And last... how exactly do I set the variables? Do I have to manually
> edit php.ini and then restart Apache? Is there a command I should be
> running?

php.ini is just a simple text file.

There are bound to be fancy editors for it, which may or may not be
useful to you.

You definitely need to restart apache, unless you are running as CGI
and then you don't.

Dislaimer: I'm not an SMTP/SpamAssassin expert by any stretch of the
imagination.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux