Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/251411-mail/
Share on other sites

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/

 

Link to comment
https://forums.phpfreaks.com/topic/251411-mail/#findComment-1289462
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/251411-mail/#findComment-1289466
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.