fonction mail() avec serveur SMTP necessitant une authentification

fonction mail() avec serveur SMTP necessitant une authentification - PHP - Programmation

Marsh Posté le 28-03-2006 à 16:25:12    

j'ai un petit probleme avec la fonction mail
 
le serveur SMTP que je souhaite utiliser requiére une authentification.
et le probléme c'est que je ne sais pas ou cela se configure (a priori ni dans le php.ini ni dans la fonction mail)
 
le serveur apache est sous windows

Reply

Marsh Posté le 28-03-2006 à 16:25:12   

Reply

Marsh Posté le 28-03-2006 à 16:30:51    

Tourvé sur php.net, pas testé.

Citation :


<?
include("Mail.php" );
 
$recipients = "mail_to@domain.mail";
 
$headers["From"]    = "mail_from@domain.mail";
$headers["To"]      = "mail_to@domain.mail";
$headers["Subject"] = "Test message";
 
$body = "TEST MESSAGE!!!";
 
$params["host"] = "smtp.server";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "user";
$params["password"] = "password";
 
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $params);
 
$mail_object->send($recipients, $headers, $body);
?>


Message édité par jol30 le 28-03-2006 à 16:32:12
Reply

Marsh Posté le 28-03-2006 à 16:35:06    

Ca peut marcher... a condition d'avoir la librairie Mail de PEAR :  
 
http://pear.php.net/package/Mail

Reply

Marsh Posté le 28-03-2006 à 16:43:06    

ca a l'air pas mal votre truc je vais tester
 
merci :jap:

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed