Note that there are some explanatory texts on larger screens.

plurals
  1. POPHPMailer Body gets truncated
    primarykey
    data
    text
    <p>I'm having some strange issues with PHPMailer. I'm trying to send some content which I generate with PHP in HTML and plain text, but the body gets truncated. What's even stranger is that this happens only to the email I generate, if I put in there some generic content in much greater length, it gets sent properly. I must also mention, I did echo the content of both <code>$content</code> and <code>$nohtmlcontent</code> variables and everything is there like it should be, but when I receive email into my mailbox, it's truncated.</p> <p>My PHP code for creating plain text and HTML email body:</p> <pre><code>$content="&lt;BODY bgColor=\"#ffffff\"&gt;&lt;FONT face=\"Verdana\" size=\"2\"&gt;"; $content.="Hello $name.&lt;br /&gt;&lt;br /&gt;Administrator of &lt;a href=\"http://$url\"&gt;$url&lt;/a&gt; has created a new account for you.&lt;br /&gt;&lt;br /&gt;Your new account details:&lt;br /&gt;"; $content.=$message."&lt;br /&gt;&lt;br /&gt;"; $content.="If you see something wrong, please reply with correct details and we will update your account.&lt;br /&gt;&lt;br /&gt;"; $content.="Have a nice day,&lt;br /&gt;$url&lt;/FONT&gt;&lt;/FONT&gt;&lt;/BODY&gt;"; $nohtmlcontent="Hello $name.\n\nAdministrator of $url has created a new account for you.\n\nYour new account details:\n\n"; $nohtmlcontent.=$usrEmail."\n\n"; $nohtmlcontent.="If you see something wrong, please reply with correct details and we will update your account.\n\n"; $nohtmlcontent.="Have a nice day,\n$url"; </code></pre> <p>All variables are populated with proper data.</p> <p>My PHPMailer code for sending email:</p> <pre><code>require_once("class.phpmailer.php"); $mail=new PHPMailer(true); try { $mail-&gt;AddAddress($email); $mail-&gt;SetFrom('admin@example.com', 'example.com'); $mail-&gt;CharSet = 'UTF-8'; $mail-&gt;Subject = "New account for you"; $mail-&gt;IsHTML(true); $mail-&gt;AltBody = $nohtmlcontent; $mail-&gt;Body = $content; $mail-&gt;Send(); return true; }catch(phpmailerException $e){ trigger_error("PHPMailer failed: ".$e-&gt;errorMessage()); return false; } </code></pre> <p>Result:</p> <pre><code>Hello 12 23. Administrator of admin.localhost.dev has created a new account for you. Your new account details: Username: user1 Password: 123456 E-Mail Address: info@tourazore.com Subscription Status: Not Verified (you must verify your email address before you can use your account) Package: Free (limitations: 1 tour, 5 items) First Name: 12 Last Name: 23 City 34 Country 45 Your verification link: http://admin.localhost.dev/verify-account/882672636ce2ad8c498f75a9b836ff055aecf573/ If you see something wrong, please reply with correct details and we will update you </code></pre> <p>Expected result:</p> <pre><code>Hello 12 23. Administrator of admin.localhost.dev has created a new account for you. Your new account details: Username: user1 Password: 123456 E-Mail Address: info@tourazore.com Subscription Status: Not Verified (you must verify your email address before you can use your account) Package: Free (limitations: 1 tour, 5 items) First Name: 12 Last Name: 23 City 34 Country 45 Your verification link: http://admin.localhost.dev/verify-account/882672636ce2ad8c498f75a9b836ff055aecf573/ If you see something wrong, please reply with correct details and we will update your account. Have a nice day, admin.localhost.dev </code></pre> <p>Please notice the extra content in the end.</p> <p>I have also tried using PHP's function <code>mail()</code> to send the same content, it also gets truncated.</p> <p>Any ideas?</p> <p><strong>SOLUTION:</strong> The PHP code generated really long line, after adding a few newline characters, the complete content got through.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload