Adding dynamic data in email

Support General Adding dynamic data in email

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36433
    YasmineYasmine
    Participant

    Hi Long,

    I'm trying to add dynamic data into the email that I autogenerate. I am taking this sort of approach:
    setting the parameters
    $insight = rwmb_get_value( $insight, $post_id );

    then adding this inside the email message text. I think this is where I'm most stuck.
    $message = " xxxxxxxfdjgfnk insight: "$insight" sxxxxx";

    then sending the email
    wp_mail( $email, $subject, $message);

    This way is causing a fatal error, so Im not sure how to approach this.

    In short, I basically want to apply this snippet for MB: https://www.wpbeginner.com/plugins/how-to-email-authors-when-their-articles-are-published-in-wordpress/

    Can you help?

    #36454
    Long NguyenLong Nguyen
    Moderator

    Hi Yasmine,

    1. The helper function needs to pass 3 arguments, if you don't want to use the second, please leave it blank. Just like

    $insight = rwmb_get_value( $insight, '', $post_id );

    2. If you want to include a variable in a value, please wrap the value in the single quote. Just like

    $message = 'xxxxxxxfdjgfnk insight: ' . $insight . ' sxxxxx';

    3. You can share the error log on your site by following this documentation https://wordpress.org/support/article/debugging-in-wordpress/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.