Zeradin Posted June 22, 2010 Share Posted June 22, 2010 I can't believe I can't find a problem similar to this on the internet. After 1024 characters, my mail messages fail. I'm using pair. I tried adding \n 's and \r's to no avail. I get the following error code: Failed to send data [sMTP: Invalid response code received from server (code: -1, response: )] I know if I get the characters down to like 984 it succeeds and sends. What gives? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 22, 2010 Share Posted June 22, 2010 Code? Quote Link to comment Share on other sites More sharing options...
Zeradin Posted June 22, 2010 Author Share Posted June 22, 2010 I solved the problem, but going to leave this up for posterity $to = 'you@you.com';$from = 'yourself@you.com';$subject = '!New Claim!'; $host = "smtp.com";$musername = "techteam@you.com";$mpassword = "pass"; $crlf = '\n'; $mime = new Mail_mime($crlf); $html = 'Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim... '; $html .= 'Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim... '; $html .= 'Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim... '; $html .= 'Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim... '; $html .= 'Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim...Hey, there\'s a new claim... '; $hdrs = array( 'From' => $from, 'Subject' => $subject ); $mime->setHTMLBody($html); $body = $mime->get(); $hdrs = $mime->headers($hdrs); $smtp =& Mail::factory('smtp', array('host'=> $host, 'auth' => true, 'username' => $musername, 'password' => $mpassword)); $mail = $smtp->send($to, $hdrs, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo(""); } the problem was: $crlf = '\n'; needs to be $crlf = "\n"; because php doesn't interpret the single quotes as a line break. so it was getting the mail in one huge string that was too long for it to handle. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.