Jump to content

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


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!

 

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.

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?

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")."

 

  • 1 month later...

Thanks!  This has actually been resolved and I see that I can mark it as such to close it. 

 

I just needed to change the declaration from text to HTML and then I was able to add regular <br> breaks where I wanted it.

 

Worked like a charm.

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.