Forums / Developer / Trouble with linebreaks in template used in mails

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Trouble with linebreaks in template used in mails

Author Message

Roy Bøhmer

Sunday 18 June 2006 2:21:38 pm

Hi!
I've made an extension, which (among other) sends email with content from a contentobject (xml-attribute). I've used the extension with success on a 3.6.1 installation, but on the current 3.7.3 it will not send email when there are linebreaks in the template(!!??). If I write everything in one line it sends without trouble.

Inserting the xml-attribute content (attribute_view_gui ..) causes the same problem. When outputing the content somewere else (not in mail) it all seems to be 100% perfect.

<b>Usefull info:</b>
Server runs LAMP php 4.4.2)
I develop on a Windows machine. I've tried saving template with linebreaks as lfcr (win) and lf (unix)
Mail is currently send via SMTP (because of some minor sendmail issues on server)

<b>Some code:</b>

$mail_tpl =& templateInit();
$mail_tpl->setVariable( 'settings_node', $settings_node );
$mailTemplateResult =& $mail_tpl->fetch( $mailTemplate ); //works. 

$confirmation_mail = new eZMail();
$confirmation_mail->setContentType( 'text/html', false, false, false );
(...)
$confirmation_mail->setBody( $mailTemplateResult ); // This is defenitly where the trouble shows
$mailResult = eZMailTransport::send( $confirmation_mail );

Any suggestion is highly appreciated!

Roy

Kristof Coomans

Monday 19 June 2006 12:05:57 am

Hi Roy

it will not send email

What's in $mailResult? Did you take a look in the SMTP server's log files?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org