gple Posted November 19, 2011 Share Posted November 19, 2011 i installed php, apache and mysql on my local windows machine and I want to use the mail function without installing a mail server. what can i do? i constantly read that i can SMTP into my webhost mail account like I do from outlook but I can never get it right, i get unauthenticated messages in my error log, any suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/251411-mail/ Share on other sites More sharing options...
trq Posted November 19, 2011 Share Posted November 19, 2011 PHP's mail function can not pass authentication. You will either need to use some third party mail library, write your own, install an smtp server, or install a relay such as ssmtp (for *nix only). Quote Link to comment https://forums.phpfreaks.com/topic/251411-mail/#findComment-1289460 Share on other sites More sharing options...
PFMaBiSmAd Posted November 19, 2011 Share Posted November 19, 2011 Edit: Basically says the same as what thorpe posted above ^^^ In order to use your web host's mail server with a remote php script, you will need to use SMTP Authentication. The php mail() function does not support SMTP Authentication (it is basically an unauthenticated email client without any support for supplying the mail box's username/password.) To use SMTP Authentication, you need to exchange SMTP commends directly with the mail server. Fortunately, there are several php mailer classes that do this for you. Two of the most popular are - php mailer http://phpmailer.worxware.com/index.php?pg=phpmailer and swift mailer - http://swiftmailer.org/ Quote Link to comment https://forums.phpfreaks.com/topic/251411-mail/#findComment-1289462 Share on other sites More sharing options...
gple Posted November 19, 2011 Author Share Posted November 19, 2011 ok i have downloaded phpmailer and placed the files withing my includes folder in my php folder. now what? Quote Link to comment https://forums.phpfreaks.com/topic/251411-mail/#findComment-1289463 Share on other sites More sharing options...
gple Posted November 19, 2011 Author Share Posted November 19, 2011 i tried copying some code offline just to test <?php require("C:\php\includes\class.phpmailer.php"); $mail = new PHPMailer();$mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->Username = 'xxxxxx'; $mail->Password = 'xxxxxx'; $mail->AddAddress("xxxxxxx@gmail.com"); $mail->Subject = "Test 1"; $mail->Body = "Test 1 of PHPMailer."; if(!$mail->Send()) { echo "Error sending: " . $mail->ErrorInfo;; } else { echo "Letter is sent"; } ?> and getting an error fputs(): supplied argument is not a valid stream resource in C:\\php\\includes\\class.smtp.php on line 212 Quote Link to comment https://forums.phpfreaks.com/topic/251411-mail/#findComment-1289466 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.