Skip to content

Proxies-free.com: 100% Free Daily Proxy Lists Every Day!

Get Free Proxies Every Day

8 – Create and use a custom Account Email Template

I am trying to create a new Email Template for the Account object using hook_form_alter. Here is how I create the template:

function my_module_form_user_admin_settings_alter(&$form, &$form_state, $form_id) {
    // Adds the Course Link email template to the Account Settings form
    $form('email_course_link') = (
        '#type' => 'details',
        '#title' => t('Course link'),
        '#description' => t('Edit the course link e-mail messages sent to mobile app users.'),
        '#group' => 'email',
    );
    $form('email_course_link')('user_mail_course_link_subject') = (
        '#type' => 'textfield',
        '#title' => t('Subject'),
        '#maxlength' => 180,
    );
    $form('email_course_link')('user_mail_course_link_body') = (
        '#type' => 'textarea',
        '#title' => t('Body'),
        '#rows' => 15,
    );
}

This adds the email template to my Account Settings form, but I am having two issues:

  1. When I go to edit the template and hit save configurations, nothing gets saved. The subject and body edits I made are wiped out and they no longer exist.

  2. When I go to use the template via _user_mail_notify('email_course_link', $user) I get NULL as the response and there are zero errors to be found and I never get the email…

What else am I missing here?

Author AdminPosted on January 29, 2021Categories ArticlesTags account, create, custom, email, template

Post navigation

Previous Previous post: Procesamiento de Audio con C++ o Python
Next Next post: python – Reason why online judge says no-output?
Proxies-free.com: 100% Free Daily Proxy Lists Every Day! Proudly powered by WordPress

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123