Jump to content

Trying to add line breaks such as <br> or <p> in a snippet without success :(


Bluemoon

Recommended Posts

I'm trying to edit a script's notification email because the generated email doesn't have any line breaks or paragraphs and is three sentences all squished together.

 

I've tried numerous attempts without any success and am hoping that a guru here might save me some time and frustration.

 

$mailMessage = __("Greetings from My Site! You received a new message from", "name")." ".$sendfrom.", ".__("You can read the message  at", "name").": ".$this->pageURL;

 

I want a line break after "Greetings from My Site!" 

 

It would be nice to have a line break after "You received a new message from ___."

 

Right now, the email looks like this: "Greetings from My Site! You received a new message from (name). You can read the message at (link)."

 

Anyone know the best way to achieve this? It seems so simple but alludes me.  :confused:

 

Thanks in advance!

 

Link to comment
Share on other sites

Thanks for your quick response. That makes sense.  However, I'm not sure the correct way to implement it. 

 

I tried this and it didn't work:

 

$mailMessage = __("Greetings from name!", "scriptname")."\r\n"  
__("You received a new message from", "scriptname.")." ".$sendfrom.". ".__("You can read the message at this link", "scriptname").": ".$this->pageURL;

 

This is very confusing code to me.

Link to comment
Share on other sites

It's a free plugin for WordPress.  I'm usually able to figure things out on my own but this has me baffled.

 

I tried this:

 

$mailMessage = __("Greetings from My Site! \n \n You received a new message from", "name" \n \n)." ".$sendfrom.", ".__("You can read the message at", "name").": ".$this->pageURL;

 

That didn't work. Do you know how to code the \n \n in this context?

Link to comment
Share on other sites

Should \r\n be in quotes and/or parenthesis?  I'm not sure how to code it properly. 

 

Would it look like this?

 

mailMessage = __("Greetings from My Site! \r\n.." 

 

Or this:

 

mailMessage = __("Greetings from My Site! "\r\n".."

 

And would this look like:

 

You received a new message from", "name" \r\n)."

 

or this:

 

You received a new message from", "name"  "\r\n")."

 

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.