0

I am trying to send mail using php. But it shows error as failed to connect with mailserver 'localhost'. Then i use smtp.bizmail.yahoo.com as SMTP mail server, then it shows SMTP error 530, Authentication required.. I don't know how to pass smtp username and password through php.ini file.. If anybody have better ideas, please suggest me.. I am struggling to solve this for more days. Thanks in advance for your suggestions.....

3
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by Dragonbaki
0

If you are using the mail() function, then authentication is not possible. You may need to use a tool like XMailer, PHPMailer or PEAR:Mail

0

Yes.. I used PHP mailer and it works wonderful in localhost server. But in live server, it does not work. So only i moved to use mail function. This also works fine but attachments not attached as a file. Attached as a encoded message inside body of mail. That's my problem.

0

Sorry.. I can't access that page u specified because of some security restrictions that i have... Below i paste my code... Now just consider my above quote and expected some good ideas from you all pls...

<?php
/*session_start();

if(isset($_SESSION['cnt']))
{
$_SESSION['cnt']=$_SESSION['cnt']+1;
}
else
{
$_SESSION['cnt']=1;
}

$ct=$_SESSION['cnt'];*/

	$filesize=$_FILES['uploadval']['size']; 

	$filetype=$_FILES['uploadval']['type']; 

	$file_tmp=$_FILES['uploadval']['tmp_name'];

/*print_r($_FILES);
exit;*/
	$target_path="uploads/";

	require_once("phpmailer/class.phpmailer.php");

	if((($filetype=="text/plain")  || ($filetype=="application/msword" )))
    	{ 
          if ($filesize<=(1048576 *2 ))
        {
	
	if(file_exists($target_path.$_FILES['uploadval']['name']))
	{
	unlink($target_path.$_FILES['uploadval']['name']);
	}
	
	if(move_uploaded_file($_FILES['uploadval']['tmp_name'],$target_path.$_FILES['uploadval']['name']))
	{

	$file=$target_path.$_FILES['uploadval']['name'];

	$mail = new PHPMailer();
	$mail->IsSMTP();
	$mail->Host = 'smtp.bizmail.yahoo.com';
	$mail->Port=25;
	$mail->SMTPAuth = true;
	$mail->Username ='aaa@bbb.com';
	$mail->Password ='abcd';

	/*$mail->From="mailer@example.com";
	$mail->FromName="My site's mailer";
	$mail->Sender="mailer@example.com";
	$mail->AddReplyTo("replies@example.com", "Replies for my site");*/


	$comments = $_REQUEST['comments'];

	$mail->AddAttachment($file); // add attachments, uploadval - is the id of the file control
	
	$mail->AddAddress("xxx@yyy.com");


	$mail->Subject = "Resume";
	
	$mail->IsHTML(true);
	$mail->Body = "<p><h3>comments :".$comments."</h3></p>";
	$mail->AltBody="This is text only alternative body.";


	if(@!$mail->Send())
	{
 	  echo "Error sending: " . $mail->ErrorInfo;
	}
	else
	{
  	 echo "Thanks for uploading your resume in our website";
	}
	}
	else
	{
	echo "Sorry.. Unable to upload your Resume... Please try again later..";
	echo $mail->ErrorInfo;
	}
	}
     else
     {
    echo "OOps!File Size Exceeds 2MB.. Unable to send.";
   exit;
        }
         }
       else
        {
    echo "Please attach .doc or .txt file.";
      exit;

        }


	?>

This works fine when i worked with localhost... But, i host it in live server, it displays nothing and mail doesn,t sent... I am struggling with this for days... Immediate help needed....

Edited by Dragonbaki: n/a

0

If you do not get errors, put in some echo statements, so you can at least see up to where the script runs.

0

Hmmm.... That also i tried... See in line 21.. i put print_r() function (executed without exit;).. it displays the uploaded file details... after that i won't get any execution detail.. only blank page.. whats the problem..?

0

Hmmm.... That also i tried... See in line 21.. i put print_r() function (executed without exit;).. it displays the uploaded file details... after that i won't get any execution detail.. only blank page.. whats the problem..?

why you use the $mail->IsSMTP(); of phpMailer you can use the $mail->IsMail(); function of phpMailer and this function not required the mail.server authentication.

0

No probs.. that directory is perfect... It is already working better in localhost and in the live server only i got this problem... I checked all of that.. But still its irritating....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.