smtp connection

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I am having difficulty connection to an smtp host.  I am using the
following code but I don't think I fully understand what smtp host can
be used.

    function setSMTPParams($host = null, $port = null, $helo = null, $auth
= null, $user = null, $pass = null)
        if (!is_null($host)) $this->smtp_params['host'] = $host;
        if (!is_null($port)) $this->smtp_params['port'] = $port;
        if (!is_null($helo)) $this->smtp_params['helo'] = $helo;
        if (!is_null($auth)) $this->smtp_params['auth'] = $auth;
        if (!is_null($user)) $this->smtp_params['user'] = $user;
        if (!is_null($pass)) $this->smtp_params['pass'] = $pass;

I don't fully understand that the $helo parameter is needed for.

Should I be able to access any smtp host which I own.  I have two ISP
account and each have an smtp service.  I use them for email.  I notice
I can only use the smtp service associated with the ISP I am currently
connected to.  Is that a common restriction which is the same reason I
am prevented from accessing the service from my php script?

Maybe the question I should this.  What type of smtp account do I need
in order to send an email from my php script?

Thanks for any help.


Re: smtp connection

*** Dan Boyle escribió/wrote (Tue, 08 Mar 2005 12:38:25 -0500):
Quoted text here. Click to load it

Then you probably don't need to do a manual connection to the host. I bet
you just want to send mail: use mail() and you're done.

In case you need SMTP authentication, you have Pear's mail classes:

Quoted text here. Click to load it

Yes. Your ISP gets a connection from you and handles it according to its
policy. It doesn't know/care whether you're using Outlook Express or PHP.

Quoted text here. Click to load it

Anyone which accepts mail from your IP address and the From address you
want to use.

-+ Álvaro G. Vicario - Burgos, Spain
+- (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox

Re: smtp connection

Dan Boyle wrote:
Quoted text here. Click to load it

Generally, the safest bet is to use the SMTP-server that your ISP
provides. An alternative method is to find the MX-record of the
recipient, and attempt to connect there. The latter will most likely
fail, since most of SMTP-servers these days refuse connections from
hosts that aren't either in their local network (the network it acts
MX for) or MX's for the network the connection is attempted from
(which rarely is the case).

Quoted text here. Click to load it

You should check RFC-821. It describes the different commands SMTP has
(at very least). To put it simply, HELO is the opening command for
SMTP-transmission channel, where the sender identifies itself to the

Quoted text here. Click to load it

That depends solely on their configuration.

Quoted text here. Click to load it

I hope this rings a bell :) You are attempting to send email from your
PHP script, are you not :D

Quoted text here. Click to load it

As I said, this is generally the case.

Quoted text here. Click to load it

You need to blame the spammers for the need of this restriction ever
rising :(

Quoted text here. Click to load it

Hmm... I'm beginning to get the whole picture... your PHP-pages are
not hosted by the same company that provides you with email? If this
is the case, you need to find out the SMTP / MX (MaileXchanger)
responsible for *their* network and use that one - of course, they
might have blocked you from using that which leaves you with ...
nothing too usefull.

Quoted text here. Click to load it

Since there are no stupid questions, here's a stupid answer: "Any one
that works for you should be just fine". The problem is always finding
one that does :)

Markku Uttula

Site Timeline