Connecting to smtp host
Posted: Tue Mar 08, 2005 11:28 am
Hi,
I am in need of help in making a connection to the smtp server so I can send out email with my php code rather than using the mail() function.
I have a smtp class that handles the php code. I don't think I understand how smtp hosts work. I know I have three different hosts available to me but I can't connect to any of them. Are there restrictions to working with these smtp hosts?
The code I am using have the following parameters.
I understand the following:
$host = something like smtp1.hostname.com. There are a lot of examples where localhost is said to be able to work. What conditions would allow localhost to work since it doesn't work for me?
$port = seems to always be 25. Is that true?
$helo I just don't understand what that is for.
$auth seems to be a TRUE or FALSE statement indicating whether a user name or password is required. How do I know if that is required or not?
$user and $pass are the user name and password and I am assuming these are the same values give to me by my ISP who runs the smtp in question.
Well, that is as much as I know. If anyone can help me to see this more clearly or let me know what limitations I might be up against that would be much appreciated.
Thanks
Dan
I am in need of help in making a connection to the smtp server so I can send out email with my php code rather than using the mail() function.
I have a smtp class that handles the php code. I don't think I understand how smtp hosts work. I know I have three different hosts available to me but I can't connect to any of them. Are there restrictions to working with these smtp hosts?
The code I am using have the following parameters.
Code: Select all
<?php
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 understand the following:
$host = something like smtp1.hostname.com. There are a lot of examples where localhost is said to be able to work. What conditions would allow localhost to work since it doesn't work for me?
$port = seems to always be 25. Is that true?
$helo I just don't understand what that is for.
$auth seems to be a TRUE or FALSE statement indicating whether a user name or password is required. How do I know if that is required or not?
$user and $pass are the user name and password and I am assuming these are the same values give to me by my ISP who runs the smtp in question.
Well, that is as much as I know. If anyone can help me to see this more clearly or let me know what limitations I might be up against that would be much appreciated.
Thanks
Dan