Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Email template code alteration

  • Elita
  • Elita's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #180115 by Elita
Replied by Elita on topic Email template code alteration
Sorry. I thought you were professional. If you looked at the templates edit panel you send me to there is not a header at all. so i assumed that header is generated somewhere else. that was my question. i can find it myself. i thought that someone that wrote that code could help.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #180116 by DenisChenu
Replied by DenisChenu on topic Email template code alteration

DenisChenu wrote: If email are already in HTML surrounded by html tag : we don't update anything.
Then : just add your won header and title in the email template editor.

We add ONLY html tag if not exist.
Then if it's exist : we don't update anything …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • Elita
  • Elita's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #180117 by Elita
Replied by Elita on topic Email template code alteration
Denis. please. in email template editor one can only edit the text that is included in the email - Invitation email body. there is not a possibility to add, delete, or do whatever I want to do with the rest of the email code - it is being generated somewhere else. So, my question is - where the email is being generated when I press the send invitation button? i mean - what is the file (or files) responsible for that?
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 2 months ago #180118 by LouisGac
Replied by LouisGac on topic Email template code alteration
email template editor -> show source code
The topic has been locked.
  • Elita
  • Elita's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #180119 by Elita
Replied by Elita on topic Email template code alteration
really? try that yourself!!
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 2 months ago #180121 by LouisGac
Replied by LouisGac on topic Email template code alteration
so, here the function to send mail:
github.com/LimeSurvey/LimeSurvey/blob/ma...mon_helper.php#L2199

As you can see here:
github.com/LimeSurvey/LimeSurvey/blob/ma...lper.php#L2310-L2314
Code:
if ($ishtml) {
        $mail->IsHTML(true);
        if (strpos($body, "<html>") === false) {
            $body = "<html>".$body."</html>";
        }

If HTML mail is enable, and if the source code of the mail does not contain the string "<html>", then the function add it.
The topic has been locked.
  • Elita
  • Elita's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #180122 by Elita
Replied by Elita on topic Email template code alteration
thanks. so back to my initial question:
How to add to the HTML head this:
1. <!DOCTYPE> should be the first element seen
2. the <head> tag must contain a title
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 2 months ago #180123 by LouisGac
Replied by LouisGac on topic Email template code alteration
If your mail body contains the string "<html>" then the function will not change it.
So, as I told you 2 messages up, use "show source" button, and add your header and code in the mail...
The topic has been locked.
  • Elita
  • Elita's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago - 5 years 2 months ago #180136 by Elita
Replied by Elita on topic Email template code alteration
nope. my email does not contain nothing. i used limesurvey built - in invitation email with what i got that error.
so. if i added proper head to the "email body" as you named it in the template editor using code editor, there will not be another head generated by the built-in script?
if so, do you think that is the proper way of handling this?
Last edit: 5 years 2 months ago by Elita.
The topic has been locked.
More
5 years 2 months ago #180137 by jelo
Replied by jelo on topic Email template code alteration

Elita wrote: if i added proper head to the "email body" as you named it in the template editor using code editor, there will not be another head generated by the built-in script?

You can provide a complete HTML page as email via the sourcemode of the editor.
As long as your HTML source contains the <HTML> tag, LimeSurvey will not add it's own stuff during generating emails.
You cannot edit the HTML stuff LimeSurvey generates, you can override it with your own html sourcecode.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: DenisChenu, Elita, LouisGac
The topic has been locked.
  • Elita
  • Elita's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #180199 by Elita
Replied by Elita on topic Email template code alteration
Thank you all for your time!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose