Jump to content

Sending E-MAILS


Ashish Sood

Recommended Posts

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

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

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 by Ashish Sood
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...