Character spacing in email sent by cron job

It is sent through cpanel email function. Have no idea if it is sent through sendmail, SMTP, through an apache handler, who knows. There is no option to send as html. There is NO OPTION to alter the “cron email”. Based on headers it is going through Exim being sent as Content-Type: text/plain; charset=UTF-8. Since it is text, there is no source to look at.

Tried br long ago and as stated above \r\n (in various formats) does not work. The ONLY thing that works is \n\n which gives dbl spacing.

So, it sounds like you are using a canned script to send out emails. Is there any reason you just don’t send your own emails out? It is super simple to do. Just add it to your cron job and don’t use the Cpanel’s version. This is a simple example without headers, I can explain them if you need it.

 <?php
// the message
$msg = "First line of text\nSecond line of text\n\nDouble-spaced 3rd line of text";
// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);
// send email
mail("[email protected]","My subject",$msg);
?> 

Not much to it so you can test!

That not going to work because running and looping through a database and I would get hundreds of emails rather than one with total output.
BUT, I solved the problem in a different way. Search cPanel and found a solution to my problem.
SSH’ed into server and edited the cron tab in /var/spool/cron/username
Added "CONTENT_TYPE=“text/html; charset=utf-8” to the file
Emails being sent as HTML and used
to solve all my problems.

Thanx for all your help

Cool ! Nice to know you solved it!

Sponsor our Newsletter | Privacy Policy | Terms of Service