Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
3.8k views
in Q2A Core by
edited by

Hai Everyone,

I need to change the ugly look of email template of all mails which generated from my q2a site. I need create an simple my own email template. Which file I needed to edit?

 

EDIT ON 30.10.2014

I mean the email template will display by a specific layout using html. and there is an logo which might be need to display on top of the mail. Example of email template screensshot is shown below. .

 


Please help me as soon as possible.

Thanks

Q2A version: version 1.6.3
by
> so we can customize and save the template right?
yes, in the "body" field of the plugn, but first you must make it work :-)
> Is this template will used for all the notification mail? Like question asked and answered etc.
yes

ps
of course, I'm not talking of the Admin-->Mailing function, but of the "Email formatting" plugin
by
Attached the email that I receive with the default template :
http://www.question2answer.org/qa/?qa=blob&qa_blobid=14929226876479317137
by
@maxjtechno thanks again :)

I customized the mail template. And it's working well...

How can I give you best answer ;)

:)
by
Your thanking is already more than ok  :-) :-)
The important thing is you've solved your issue...

2 Answers

0 votes
by

Mail texts are stored in qa-include/qa-lang-emails.php. They should support HTML in them which would be enough to make something more appealing.

Of course, you should edit the qa-lang-emails.php for your language file, if any. Or if you are using the default language then you can create the file qa-lang/custom/qa-lang-emails.php by copying the one in qa-include and customize it your own.

by
But in qa-include/qa-lang-emails.php page has only the email contents listing. How can override with an template. Please help
Thanks
by
But a template IS the email content, isn't it? What do you mean by template? Please, show me a sample.
by
@pupi1985: Thanks for the reply . Actually my need is the email template should display by a specific layout using html and there is an site-logo which might be need to display on top of the mail.Now q2a have an ugly look mail. Need neat look. An Example of email template screensshot is shown on my post [EDITED]. please check
by
Your screenshot shows an HTML file that references objects such as images. Emails support HTML. So create the HTML file, turn it into a long string and paste it into the corresponding line in qa-lang-emails.php.

Now, if by template you mean "sharing email content among different keys in the previous file and just configure a few texts" then that won't be possible. You'll have to copy the content in each line and then customize each of the texts.
by
@pupi1985 : You are saying the html content will supports on qa-lang-emails.php. For example I am going to add the below code for overriding the email template using html tags. Is this will works fine for me .
Please look below


 return array(
        'a_commented_body' => "<html><table><tr style=" background-color:red"><td>Your answer on ^site_title has a new comment by ^c_handle:\n\n^open^c_content^close\n\nYour answer was:\n\n^open^c_context^close\n\nYou may respond by adding your own comment:\n\n^url\n\nThank you,\n\n^site_title</td></tr></table></html>",


Please help. Thanks
by
Yes, it should. However, bear in mind you need to escape the quotes inside the quotes. For example, instead of:
style="background-color:red">

You should use this:
style=\"background-color:red\">
by
But it doesn't works for me
My code is below


        'q_answered_body' => "<html><body  style='background-color:#FFE6FF'><table width=\"765\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"border: 1px solid #B5EBDB\"><tr>
        <td background=\"http://reasonablespread.com/spreadresource/template/email/43/images/BusinessBasic_03.jpg\">&nbsp;</td>
        </tr><tr style=\"background-color:#FCC\"><td style=\"background-color:#FFC\">
       
        Your question on ^site_title has been answered by ^a_handle:\n\n^open^a_content^close\n\nYour question was:\n\n^open^q_title^close\n\nIf you like this answer, you may select it as the best:\n\n^url\n\nThank you,\n\n^site_title
       
        </td></tr></table></body></html>",
        'q_answered_subject' => 'Your ^site_title question was answered',

in qa-include/custom/qa-lang-emails.php
by
A few comments.

1. "it doesn't works for me" is like going to the doctor and say "I'm not feeling well, what should I take?" :)

2. You have syntactical errors in your pasted code, eg: style='background-color:#FFE6FF'

3. You should test your HTML code in a browser first. Create a file in your desktop, put the content in it, check it looks good. Then try to add it to the email string. Each email server processes HTML files differently. I've seen some that expect you to add "<html><body>" while others don't. There is a lot of trial and error here. But that is absolutely unrelated to Q2A.
by
Thanks for the reply :)
I will try
0 votes
by
It may be over spec for you. But, "Notification Pro" has its feature (Conversion to multipart email + Customizable email template). The default template is the template of popular mailchimp. If you have HTML and CSS knowledge, you are free to customize HTML email.
 
Reference:
 
 
Excerpt of the user's manual:
 
File extension
  *.txt: Template for plain text part
  *.html: Template for HTML text part
  *.css: Style for HTML text part
 
File explanation of main part
  main.html: Template of basic part applied to all emails
  style.css: Style applied to all emails
 
Conversion rule of main part
  [title]: Converted to “mail title”
  [style]: Converted to contents in “style.css”
  [site_url]: Converted to “site URL”
  [site_title]: Converted to “site title”
  [headerContent]: Converted to “images/eyecatch_600px.png”
    This is commented with initial state.
  [body]: Converted to email content
  [unsubscribe]: Converted to “unsubscribe link”
    This is displayed only in the case of email sent by NP.
...