Jump to content

[SOLVED] Email help


ccrevcypsys

Recommended Posts

Warning: mail() [function.mail]: SMTP server response: 501 5.1.7 Invalid address in D:\Sites\csitechs\orderEmail.php on line 101

 

thats the error i get when i try to send any emails out from my page. Why does it say invalad address i know its right... heres the code

 

<?php
ini_set("display_errors",1);
ini_set("SMTP", "mailback");
parse_str($_SERVER['QUERY_STRING']);
//phpinfo();
//Start the customer and est number
$customer = Trim(stripslashes($_POST['customer']));
$estimate = Trim(stripslashes($_POST['estimate']));
//Start the part table
$part1 = Trim(stripslashes($_POST['part1']));
$description1= Trim(stripslashes($_POST['description1']));
$qty1 = Trim(stripslashes($_POST['qty1']));
$part2 = Trim(stripslashes($_POST['part2']));
$description2 = Trim(stripslashes($_POST['description2']));
$qty2 = Trim(stripslashes($_POST['qty2']));
$part3 = Trim(stripslashes($_POST['part3']));
$description3 = Trim(stripslashes($_POST['description3']));
$qty3 = Trim(stripslashes($_POST['qty3']));
$part4 = Trim(stripslashes($_POST['part4']));
$description4 = Trim(stripslashes($_POST['description4']));
$qty4 = Trim(stripslashes($_POST['qty4']));
$part5 = Trim(stripslashes($_POST['part5']));
$description5 = Trim(stripslashes($_POST['description5']));
$qty5 = Trim(stripslashes($_POST['qty5']));
$part6 = Trim(stripslashes($_POST['part6']));
$description6 = Trim(stripslashes($_POST['description6']));
$qty6 = Trim(stripslashes($_POST['qty6']));
$part7 = Trim(stripslashes($_POST['part7']));
$description7 = Trim(stripslashes($_POST['description7']));
$qty7 = Trim(stripslashes($_POST['qty7']));
$part8 = Trim(stripslashes($_POST['part8']));
$description8 = Trim(stripslashes($_POST['description8']));
$qty8 = Trim(stripslashes($_POST['qty8']));
$part9 = Trim(stripslashes($_POST['part9']));
$description9 = Trim(stripslashes($_POST['description9']));
$qty9 = Trim(stripslashes($_POST['qty9']));
$part10 = Trim(stripslashes($_POST['part10']));
$description10 = Trim(stripslashes($_POST['description10']));
$qty10 = Trim(stripslashes($_POST['qty10']));
//Start the requested by needed by and comments
$myName = Trim(stripslashes($_POST['myName']));
$myNeed = Trim(stripslashes($_POST['myNeed']));
$myComments = Trim(stripslashes($_POST['myComments']));
$urg = Trim(stripslashes($_POST['urg']));

// validation
$validationOK=true;
//if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error1.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Customer Name: ";
$Body .= $customer;
$Body .= "\n";
$Body .= "Estimate Number: ";
$Body .= $estimate;
$Body .= "\n";
$Body .= "Part Number ------ Description ------ Qty ";
$Body .= $part1." ------ ".$description1." ------ ".$qty1;
$Body .= "\n";
$Body .= $part2." ------ ".$description2." ------ ".$qty2;
$Body .= "\n";
$Body .= $part3." ------ ".$description3." ------ ".$qty3;
$Body .= "\n";
$Body .= $part4." ------ ".$description4." ------ ".$qty4;
$Body .= "\n";
$Body .= $part5." ------ ".$description5." ------ ".$qty5;
$Body .= "\n";
$Body .= $part6." ------ ".$description6." ------ ".$qty6;
$Body .= "\n";
$Body .= $part7." ------ ".$description7." ------ ".$qty7;
$Body .= "\n";
$Body .= $part8." ------ ".$description8." ------ ".$qty8;
$Body .= "\n";
$Body .= $part9." ------ ".$description9." ------ ".$qty9;
$Body .= "\n";
$Body .= $part10." ------ ".$description10." ------ ".$qty10;
$Body .= "\n";
$Body .= "Requested By: ";
$Body .= $myName;
$Body .= "\n";
$Body .= "Needed By: ";
$Body .= $myNeed;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $myComments;
$Body .= "\n";
$Body .= "Urg: ";
$Body .= $urg;
$Body .= "\n";

$EmailTo = "ccrevling@cypsys.com";
$EmailFrom= "ccrevling@cypsys.com";
$Subject = "P.O. Customer:".$customer." By: ".$myName;

// send email
$success=mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
?>

Link to comment
Share on other sites

ok well since i was last on yesterday i have come up with this.

<?php
ini_set("display_errors",1);
ini_set("SMTP", "192.168.0.12");
$EmailFrom= "cyppurch@cypsys.com";
ini_set("sendmail_from","cyppurch@cypsys.com");
parse_str($_SERVER['QUERY_STRING']);
//phpinfo();
//Start the customer and est number
$customer = Trim(stripslashes($_POST['customer']));
$estimate = Trim(stripslashes($_POST['estimate']));
//Start the part table
$part1 = Trim(stripslashes($_POST['part1']));
$description1= Trim(stripslashes($_POST['description1']));
$qty1 = Trim(stripslashes($_POST['qty1']));
$part2 = Trim(stripslashes($_POST['part2']));
$description2 = Trim(stripslashes($_POST['description2']));
$qty2 = Trim(stripslashes($_POST['qty2']));
$part3 = Trim(stripslashes($_POST['part3']));
$description3 = Trim(stripslashes($_POST['description3']));
$qty3 = Trim(stripslashes($_POST['qty3']));
$part4 = Trim(stripslashes($_POST['part4']));
$description4 = Trim(stripslashes($_POST['description4']));
$qty4 = Trim(stripslashes($_POST['qty4']));
$part5 = Trim(stripslashes($_POST['part5']));
$description5 = Trim(stripslashes($_POST['description5']));
$qty5 = Trim(stripslashes($_POST['qty5']));
$part6 = Trim(stripslashes($_POST['part6']));
$description6 = Trim(stripslashes($_POST['description6']));
$qty6 = Trim(stripslashes($_POST['qty6']));
$part7 = Trim(stripslashes($_POST['part7']));
$description7 = Trim(stripslashes($_POST['description7']));
$qty7 = Trim(stripslashes($_POST['qty7']));
$part8 = Trim(stripslashes($_POST['part8']));
$description8 = Trim(stripslashes($_POST['description8']));
$qty8 = Trim(stripslashes($_POST['qty8']));
$part9 = Trim(stripslashes($_POST['part9']));
$description9 = Trim(stripslashes($_POST['description9']));
$qty9 = Trim(stripslashes($_POST['qty9']));
$part10 = Trim(stripslashes($_POST['part10']));
$description10 = Trim(stripslashes($_POST['description10']));
$qty10 = Trim(stripslashes($_POST['qty10']));
//Start the requested by needed by and comments
$myName = Trim(stripslashes($_POST['myName']));
$myNeed = Trim(stripslashes($_POST['myNeed']));
$myComments = Trim(stripslashes($_POST['myComments']));
$urg = Trim(stripslashes($_POST['urg']));
$EmailTo = "err50webdesign@yahoo.com";

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error1.htm\">";
  exit;
}
// prepare email body text
$Body = "";
$Body .= "Customer Name: ";
$Body .= $customer;
$Body .= "\n";
$Body .= "Estimate Number: ";
$Body .= $estimate;
$Body .= "\n";
$Body .= "<table bgcolor='#0066CC' border='1' bordercolor='#660099' style='color:#ffffff;'><tr><td>Part Number </td><td> Description </td><td> Qty </td></tr>";
$Body .= "<tr><td>".$part1." </td><td> ".$description1." </td><td> ".$qty1." </td></tr>";
$Body .= "<tr><td>".$part2." </td><td> ".$description2." </td><td> ".$qty2." </td></tr>";
$Body .= "<tr><td>".$part3." </td><td> ".$description3." </td><td> ".$qty3." </td></tr>";
$Body .= "<tr><td>".$part4." </td><td> ".$description4." </td><td> ".$qty4." </td></tr>";
$Body .= "<tr><td>".$part5." </td><td> ".$description5." </td><td> ".$qty5." </td></tr>";
$Body .= "<tr><td>".$part6." </td><td> ".$description6." </td><td> ".$qty6." </td></tr>";
$Body .= "<tr><td>".$part7." </td><td> ".$description7." </td><td> ".$qty7." </td></tr>";
$Body .= "<tr><td>".$part8." </td><td> ".$description8." </td><td> ".$qty8." </td></tr>";
$Body .= "<tr><td>".$part9." </td><td> ".$description9." </td><td> ".$qty9." </td></tr>";
$Body .= "<tr><td>".$part10." </td><td> ".$description10." </td><td> ".$qty10." </td></tr></table>";
$Body .= "\n";
$Body .= "Requested By: ";
$Body .= $myName;
$Body .= "\n";
$Body .= "Needed By: ";
$Body .= $myNeed;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $myComments;
$Body .= "\n";
$Body .= "Urg: ";
$Body .= $urg;
$Body .= "\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"Csi Techs\" <cyppurch@cypsys.com>\n";

$Subject = "P.O. Customer:".$customer." By: ".$myName;

// send email
$success=mail($EmailTo, $Subject, $Body, $headers);


if($success==TRUE){
echo $Body;
echo "<BR> YES IT SENT... i hope.";
}

?>

it is alot different. i even added headers. But now i get this error...

Warning: mail() [function.mail]: SMTP server response: 530 5.7.1 Client was not authenticated in D:\Sites\csitechs\orderEmail.php on line 98

and its lame my company needs this email to work. We just migrated servers so that could very well be an issue but i dont know enough about that to investigate...

Link to comment
Share on other sites

Do you really need this

 

ini_set("SMTP", "192.168.0.12");
ini_set("sendmail_from","cyppurch@cypsys.com");

 

I got a simple mail example in PHP manual and it has worked for me a lot.... it is simple though

I used this code, and it is working till now, only issue is that the mail comes to my bulk folder

<?php
$to      = 'nobody@example.com'; //here i kept my mail 
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?> 

Link to comment
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.