smtp connection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan Boyle

    smtp connection

    Hi,

    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.

    Dan

  • Alvaro G. Vicario

    #2
    Re: smtp connection

    *** Dan Boyle escribió/wrote (Tue, 08 Mar 2005 12:38:25 -0500):[color=blue]
    > I don't fully understand that the $helo parameter is needed for.[/color]

    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:



    [color=blue]
    > 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?[/color]

    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.

    [color=blue]
    > Maybe the question I should this. What type of smtp account do I need
    > in order to send an email from my php script?[/color]

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


    --
    -+ Álvaro G. Vicario - Burgos, Spain
    +- http://www.demogracia.com (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
    --

    Comment

    • Markku Uttula

      #3
      Re: smtp connection

      Dan Boyle wrote:[color=blue]
      > 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.[/color]

      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).
      [color=blue]
      > I don't fully understand that the $helo parameter is needed for.[/color]

      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
      receiver.
      [color=blue]
      > Should I be able to access any smtp host which I own.[/color]

      That depends solely on their configuration.
      [color=blue]
      > I have two ISP
      > account and each have an smtp service. I use them for email.[/color]

      I hope this rings a bell :) You are attempting to send email from your
      PHP script, are you not :D
      [color=blue]
      > I
      > notice I can only use the smtp service associated with the ISP I am
      > currently connected to.[/color]

      As I said, this is generally the case.
      [color=blue]
      > Is that a common restriction[/color]

      You need to blame the spammers for the need of this restriction ever
      rising :(
      [color=blue]
      > which is the
      > same reason I am prevented from accessing the service from my php
      > script?[/color]

      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.
      [color=blue]
      > Maybe the question I should this. What type of smtp account do I
      > need
      > in order to send an email from my php script?[/color]

      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

      Comment

      Working...