• Resolved webmark487

    (@webmark487)


    Hi,

    My goal is to receive an email after a new event is added on a page, where shortcode [emefs_submit_event_form] is used.

    I referred to https://www.e-dynamics.be/wordpress/category/documentation/12-hooks-and-filters/

    and inserted into the themes functions.php the following code:

    add_action('eme_insert_event_action','eme_mail_event');
    function eme_mail_event ($event) {
       $contact = eme_get_event_contact ($event);
       $contact_email = $contact->user_email;
       $contact_name = $contact->display_name;
       $subject_format="This is the new event called ' #_EVENTNAME '";
       $body_format="This is the new event called ' #_EVENTNAME '";
    
       $subject=eme_replace_placeholders($subject_format, $event, "text");
       $body=eme_replace_placeholders($body_format, $event, "text");
       $blogusers = get_users();
       foreach ( $blogusers as $user ) {
          eme_send_mail($subject,$body, $user->user_email, $user->display_name, $contact_email, $contact_name);
       }
    }

    but unfortunately I don′t receive an email …

    May the theme be the problem? Does the theme have to provide something?

    Best regards and thank you,
    Markus

    • This topic was modified 5 years, 5 months ago by webmark487.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter webmark487

    (@webmark487)

    it works now

    In the E-Mail settings I switched from SMTP to PHP mailfunction now …

    And use the following code:

    add_action(’eme_insert_event_action’,’eme_mail_event’);
    function eme_mail_event ($event) {
    $from_email = "[email protected]";
    $from_name = "Markus1";
    $to_email = "[email protected]";
    $to_name = "Markus2";
    $subject_format=”This is the new event called ‘ #_EVENTNAME ‘”;
    $body_format=”This is the new event called ‘ #_EVENTNAME ‘”;
    
    $subject=eme_replace_placeholders($subject_format, $event, “text”);
    $body=eme_replace_placeholders($body_format, $event, “text”);
    eme_send_mail($subject,$body, $to_email, $to_name, $from_email, $from_name);
    }
    • This reply was modified 5 years, 5 months ago by webmark487.
Viewing 1 replies (of 1 total)
  • The topic ‘Email notification after an event is added’ is closed to new replies.