Ashish Sood Posted December 3, 2013 Share Posted December 3, 2013 Hi All,I tried to make a PHP script which used to send the mails to all the clients for the i thought first to make a dummy scirpt, But its fail during sending the mail. Below is a error messageWarning: mail(): SMTP server response: 530 5.7.1 Client was not authenticated in C:inetpubwwwrootdummyemailemail_script.php on line 10I don't know what authentication its need. Please help me to overcome from this problem.Below is my php script <?php$from="testturnover@abc.com";$email=$_POST['email'];$subject=$_POST['subject'];$message=$_POST['message'];mail($email, $subject, $message,"From:".$from);print "email has been sent : </br> $email</br>$subject</br>$message</br>";?> Is this warning appear because of wrong SMTP server address ? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 3, 2013 Share Posted December 3, 2013 You could be because the settings are not correct, you can check the SMTP settings in php.ini. Otherwise, it sounds like you're connecting to an SMTP server that requires authentication but isn't getting it. Link to comment Share on other sites More sharing options...
Ashish Sood Posted December 3, 2013 Author Share Posted December 3, 2013 What kind of authentication its asking..? My company using exchange server Link to comment Share on other sites More sharing options...
justsomeguy Posted December 3, 2013 Share Posted December 3, 2013 Authentication means a username and password. Link to comment Share on other sites More sharing options...
Ashish Sood Posted December 4, 2013 Author Share Posted December 4, 2013 But where i need to give it mail function itself does'nt have this parameter.. for username and password ? Link to comment Share on other sites More sharing options...
Ashish Sood Posted December 4, 2013 Author Share Posted December 4, 2013 Can some one reply me on my last post Link to comment Share on other sites More sharing options...
justsomeguy Posted December 4, 2013 Share Posted December 4, 2013 That's right, PHP's mail function does not support authentication. I would recommend using the phpmailer or Pear Mail package instead of the built-in mail function. The mail function is really just an interface to sendmail on a Unix machine, if you're not using sendmail then I wouldn't use the mail function. Link to comment Share on other sites More sharing options...
Ashish Sood Posted December 8, 2013 Author Share Posted December 8, 2013 Its worked for me there was a problem in my SMTP address, and i have changed it and everything is working for me Link to comment Share on other sites More sharing options...
Ashish Sood Posted December 8, 2013 Author Share Posted December 8, 2013 (edited) Now i am getting the mails, But the mails is clearly in the plain text format below is the output of a mail First Name : Rohit Last Name: kapoor Comments : xyz I want some formatting on the outgoing mails, Can it will be possible like (If I bold [First Name, Last Name]) so it looks more good Below is the code.. $from="some@abc.com";$email="Rohit@xyz.com";$subject="You are registered on $date";$message='Fist Name : '.$First."n" .'Last Name : '.$last."n" .'Comments : '.$comments."n"; mail($email, $subject, $message,"From:".$from, "-f$from"); Thanks in advance Edited December 8, 2013 by Ashish Sood Link to comment Share on other sites More sharing options...
justsomeguy Posted December 9, 2013 Share Posted December 9, 2013 You can send a content-type header to change it to text/html. But, you'll also want a text version if the user's mail client doesn't support HTML email (or they have it disabled). That's another reason to use a library like PhpMailer or Pear Mail. You can create the multi-part email yourself with the correct headers and body content, or you could have one of those libraries do it for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now