Opening this issue about saving and editing mail templates as a clean start for this issue: http://drupal.org/node/1309256#comment-5158962

I cant seem to get the mail editor to save edited templates.

1 .On a 100% clean install with modules installed and patches applied the mail is sent but without body and subject.
2. I go to mail templates, click add, and click 'update template'. From now on the mail body and subject is sent, according to standard tempalte.
3. I go to mail templates and click PURGE, still the original mailtemplate is sent.
4. I go to mail templates and click 'add' (aftger purging) and change something in the template and click update template. Template isnt saved and the original template is sent.

After adding mail templates the MAIL_EDIT column in the drupal mysql table remains empty. i assume it should be saving the tempaltes to this place.

Comments

piemanji’s picture

Version: 7.x-1.x-dev » 7.x-1.0-alpha2

I've got the same problem of templates not saving. Using 7.x-1.0-alpha2 with Drupal 7.7.

salvis’s picture

There is no such thing as a "drupal mysql table" with a "MAIL_EDIT column".

There is a Drupal MySQL database, which contains a "mail_edit" table, commonly referred to as {mail_edit}. The templates are stored in rows of that table, specifically in the "subject" and "body" columns.

The sequence of events that you describe does not make sense to me.

Please let's try this with a User template first:

  1. Assuming that you have not defined any User templates, log out, go to user/password, and send yourself a password reset email.
  2. Verify that you receive it, including subject and body.
  3. Log in and go to admin/config/system/mail-edit/user_password_reset/en
  4. Verify that you see Drupal's default template for sending a password reset email.
  5. Insert "(EDITED)" at the beginning of the Subject.
  6. Click the [Save new template] button.
  7. This gets you back to the admin/config/system/mail-edit page — verify that your "add" link has now changed into an "edit" link.
  8. Click the "edit" link to go to admin/config/system/mail-edit/user_password_reset/en again.
  9. Verify that you see the "(EDITED)" word that you inserted. If you see it, then the template was obviously saved, and you must stop claiming that ME doesn't save templates.
  10. Now log out, go to user/password, and send yourself a password reset email.
  11. Verify that you get the email and that it has the "(EDITED)" word.
  12. To complete the picture, if you have a way to look at the contents of the {mail_edit} table, verify that you see the "(EDITED)" word in the "subject" column in one of the rows.
  13. Now you can play with "remove" and "purge" and the password reset email should always come out as expected, and its row in the {mail_edit} table should follow along nicely — at least it does for me.

Please report your findings...

BTW, be sure that you never ever have more than one copy of any module under the webroot directory. Don't try to save older versions by renaming their directory.

nuez’s picture

thanks salvis for the instructions.
just in case ive downloaded the latest dev versiosn since yesterday. with "drush dl mail_edit --dev" etc.

i did as you told and these are my results.

1. check
2. check
3.check
4. check
5. check
6. there is now 'SAVE NEW TEMPLATE' button, there is only a 'UPDATE TEMPLATE' button. also 'remove en translation' and 'preview template.' but no 'save new template'. i click update template.
7. check . with drupal notification: "Saved the user_password_reset template for the en translation."
8. The button 'add' hasnt changed into ' edit.
9. no edited strings inserted...nothing changed.
10. no updated email send
11. nope
12. no record what so ever in the {mail_edit} table (excuse my nomenclature typo in the earlier comment)
13 .n/a

Not trying to claim anything, merely reporting. I almost think that it must have something to do with the versions as if im working with versions that are not the same as yours, as it works perfectly fine on your installation. i will try and figure out what it is, if im doing something wrong here, but i cant imagine what it is...will run over it again this afternoon, to see if i miss something.

im using a localhost environment VirtualBox with Quickstart (drupal.org/project/quickstart)

DRUPAL 7.9 (but also tried this earlier on 7.8)

I've downloaded the modules through the drush command: drush dl subscriptions --dev. drush dl mail_edit --dev.
I have admin_menu installed and run cron and update with the admin_menu module. clear caches with drush.

piemanji’s picture

1. Done
2. Done
3. Done
4. Done
5. Done
6. Again, click Update Template, rather than Save New Template
7. 'Add' has not changed to edit. I also get an error message:
Notice: Undefined index: name in _mail_edit_module_list() (line 339 of /(mywebsite)/sites/all/modules/mail_edit/mail_edit.admin.inc).
8. Tried clicking Add again
9. Nothing's changed - the (EDITED) doesn't appear

I'll try updating to latest dev version and let you know what happens. (By the way I'm now using 7.9.)

piemanji’s picture

Same results with latest dev version. I am working on a test version of my website, but have also found same results on main site.

The other thing is that when I click 'preview template' I get the following error:
Fatal error: Call to undefined function language_initialize() in /(mywebsite)/sites/all/modules/subscriptions/subscriptions_mail.mail_edit.inc on line 178

EDIT: Just realised that undefined function is in the subscriptions module. Seems the two are tied very closely together. I am using the latest dev version of subscriptions too if that helps with the debugging process.

salvis’s picture

Thank you both for running those tests. I'm really puzzled by this. We don't have anyone actually confirming that they can save the templates, but according to the usage statistics we have well over 100 sites with ALPHA2 installed, and I would expect to get more complaints if it wasn't working.

What are your PHP versions?

I forgot an important step. It should have been

3a) Log in and go to admin/config/system/mail-edit
3b) Verify that you have an "add" link for "password_reset"
3c) Click on the "add" link to go to admin/config/system/mail-edit/user_password_reset/en

I was assuming that you didn't have a "password_reset" template yet, but the only explanation for seeing the [Update template] and [Remove English translation] buttons is that ME thinks you already have one.

Do you have a tool for looking at your database tables, e.g. PhpMyAdmin? Please look up your {mail_edit} and {mail_edit_registry} database tables. Then disable and uninstall (two steps!) Mail Editor and verify that the tables are gone. Then reinstall Mail Editor again and verify that the tables are back and empty. Then do #1 through #9 again, this time with 3abc).

I'm sorry this is such a pain — I'm still completely in the dark!

 

So you never see the [Save new template] button? Never ever?

 

@nuez:

Not trying to claim anything, merely reporting.

Please excuse my poor choice of words. I'm irritated by that fact that you reported #1323424: token error on cron after updating a mail template. (as if you were able to save templates) and at the same time #1323452: Mail editor doesnt save templates. I have a hard time to reconcile these two reports. It seems to me that if you cannot save, you cannot update...

 

@piemanji:

Fatal error: Call to undefined function language_initialize()

Please only one issue per issue. That one has already been reported: #1323422: "Call to undefined function language_initialize()" when previewing mail edit for subscriptions.. It's fixed on my computer and waiting for this issue here to be resolved before I can push it.

 

EDIT: One more question: how many languages to you have on your site?

(I've changed the "Remove English translation" to "Remove template" or "Remove English template", depending on whether you have just English or multiple languages.)

nuez’s picture

hello salvis,

i've tried this on various installations: all of them with php 5.3 + (5.3.5 on my localhost). To stick to one report i will describe my installation as it is on my localhost:

just english installed. i click on 'add' at password reset. It takes me to: admin/config/system/mail-edit/user_password_reset/en

buttons at the bottom of the page are: preview tempate, update template, remove template.

1. i click on remove template : after confirming the message is: Failed to remove the user_password_reset template.
2. i click on update template: message is: Saved the user_password_reset template for the en translation.
3. i click on preview template: Fatal error: Call to undefined function language_initialize() in /home/quickstart/websites/5test.dev/sites/all/modules/subscriptions/subscriptions_mail.mail_edit.inc on line 178

I check the database: tables {mail edit} and {mail_edit_registry} are there. {mail_edit_registry} is not empty but has all the records of the list.

Proceeding to uninstalling (through drupal, not drush, to avoid problems)
tables have disappeared.

1. installing mail edit only (not subscriptions mail)
2. checking 1 to 9: i have now only two buttons: update template and remove template.
3. updating template, same symptoms, table {mail_edit} remains empty.

tomorrow or wednesday i will try with the latest versions and try to look into it (allthough it will take me some time to understand the whole module), hope i can help you out,

salvis’s picture

Version: 7.x-1.0-alpha2 » 7.x-1.0-beta1
Status: Active » Fixed

Thank you for going through this again, nuez!

i click on 'add' at password reset. It takes me to: admin/config/system/mail-edit/user_password_reset/en

buttons at the bottom of the page are: preview tempate, update template, remove template.

This is where things become spooky, because if the list page shows "add", then there's no saved template yet, and the edit page should show [Save new template].

Well, I think I've finally found and fixed the problem!

Please check out the -dev version (give it up to 12h to be repackaged)...

Not having the [Preview template] button without subscriptions_mail.module is normal, because that functionality if courtesy of SM. I was surprised that it actually somewhat works with the User templates, and I've left it in for now, but in principle it's the Mail Editor client that needs to provide that functionality.

marko42’s picture

I've just updated to new -dev and can confirm that the templates are being saved. I can create, save and edit. Plus the proper record appears in {mail_edit}.

Thanks!

nuez’s picture

it works! thanks salvis,

salvis’s picture

Great, thanks for the confirmations!

kriskhaira’s picture

Had the same problem but the latest dev works for me. Thanks, salvis!

pheraph’s picture

I can confirm that the latest -dev solved the problem. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.