RE: SMTP

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

 



> -----Original Message-----
> From: Ray Hauge [mailto:ray.hauge.lists@xxxxxxxxx]
> Sent: Sunday, March 09, 2008 5:17 PM
> To: Alain Roger
> Cc: PHP General List
> Subject: Re:  SMTP
> 
> Alain Roger wrote:
> > Hi,
> >
> > i know that this is not necessary the best forum for that, but i need to
> get
> > a real feedback and i guess you already faced the same issue as mine.
> > basically, i develop php web application on windows XP platform.
> > So i have apache 2.24 installed and PHP 5.2.4.
> >
> > now i would like to test if my application send emails, so i've checked
> my
> > php.ini file and it seems ok.
> > i tried to use IIS from windows to define a default SMTP server, but as
> my
> > emails are not sent, i guess something is wrong with IIS.
> >
> > so does it exist a free SMTP server (similar that linux daemon) but
> running
> > on windows XP ?
> > if yes, where can i find it and what steps should i perform to be sure my
> > emails are sent ?
> >
> > i do not want to transfer all my web application each time i want to test
> > email sending...
> > i would like to test it locally.
> >
> > thanks for your feedback.
> >
> 
> I could be wrong, but I thought that you had to specify the SMTP server
> in the php.ini file.
> 
> http://us2.php.net/manual/en/ref.mail.php#ini.smtp
> 
>  > now i would like to test if my application send emails, so i've
> checked my
>  > php.ini file and it seems ok.
> 
> Maybe that means you already did that.  The second issue might be that
> your SMTP server is MS Exchange, and it requires authentication.
> 
> If that is the case, then search for php SMTP authentication:
> 
> http://www.google.com/search?q=php+smtp+authentication&ie=utf-8&oe=utf-
> 8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
> 
> --
> Ray Hauge
> www.primateapplications.com

Hi Alain,

I think you have two options:

1 - Install a MTA in your windows box, such as Mercury Mail (if you install
XAMPP, you get Apache, PHP, MySQL, Filezilla FTP Server and Mercury Mail - use
google to know what XAMPP is). To use the "mail" function on windows, you will
NEED a MTA (correct me if I'm wrong, but sendmail is not available "in PHP for
Windows", the "mail" function will try to reach an MTA on port 25 or the port
you have set up in your php.ini).

2 - Use SMTP Authentication to send out emails on behalf of an existing
authenticated email box (or a relay server if you find one).

If you choose the second option (SMTP authentication) you will likely also use
PHPMailer (or PEAR_Mail, or any of the featured classes at
http://www.phpclasses.org that support SMTP authentication) unless you are
willing to write your own class for SMTP stuff through sockets. So let's say you
have an email box with the following information:

User: myemail@xxxxxxxxxxxx
Password: mypassword
SMTP Server: smtp.mydomain.com

Your PHPMailer code will look like:

	$mail = new PHPMailer();
	$mail->Mailer = 'smtp';
	$mail->SMTPAuth = true;
	$mail->Username = 'myemail@xxxxxxxxxxxx';
	$mail->Password = 'mypassword';
	$mail->Host = 'smtp.mydomain.com';
	$mail->From = 'myemail@xxxxxxxxxxxx';
	$mail->FromName = 'My beautiful website';
	$mail->Subject = 'You know what this is';
	$mail->Body = 'Your email message';
	$mail->AddAddress('destination@xxxxxxxxxxxxxxx', 'Mr X-Man');
	$mail->AddReplyTo('myemail@xxxxxxxxxxxx', 'My Beautiful Website');
	$mail->Send();

Hope this helps. This issue drove me crazy on my first month with PHP... what is
worse, I asked in the office I worked for at that time. They said "it was not
possible" (great I don't work there anymore). As "The Rock" said... "NEVER SAY
NO" :).

Cheers,

Rob(inet)

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: info@xxxxxxxxxxxxx  | MSN Chat: best@xxxxxxxxxxxxx  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com




-- 
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