I need to send mail with PHP and I use mail function like this:
$subject = "test";
$message = "Large message";
$headers = "Content-type: text/html; charset=iso-8859-1; \n".
mail('someone@example.com', $subject, $message, $headers);
This code doesn’t work (comes only subject) when $message is large. And it works when I write code like this:
$subject = "test";
$headers = "Content-type: text/html; charset=iso-8859-1; \n".
mail('someone@example.com', $subject, "large message", $headers);
Please help me with it?
The indicated period in both blocks of code turn the two lines into a string concatentation operation, which is probably what you don’t want.
As well, don’t build mime emails yourself, or even use the built-in mail() function. It’s uttery useless for debugging, giving you only true/false diagnostics. Use Swiftmailer or PHPMailer, both of which give you far better error messages, and make mime emails trivial to generate.