Support

Account

Home Forums General Issues Send mail from functions.php when row is added in fro

Unread

Send mail from functions.php when row is added in fro

  • Hi!

    I need to send an email when a row is added to a post in the frontend.

    I use the add_row function to create new rows. This is working perfect 🙂
    `

                    <?php 
                        if(isset($_POST['submit'])) {
                            date_default_timezone_set('Europe/Berlin');
                            $date = date('Y-m-d H:i:s');
                            $author = get_current_user_id();
                            $message = $_POST['message-text'] . $date;
                            
                            $row = array(
                                /* DATE */ 'field_5ba5f28b255df' => $date,
                                /* AUTHOR */ 'field_5ba5f2a0255e0' => $author,
                                /* ART */ 'field_5ba8ade088e01' => 'message',
                                /* MESSAGE */ 'field_5ba5f2be255e1' => $message
                            );
    
                            $i = add_row('field_5ba5f262255de', $row);
                                
                            // RELOAD PAGE AFTER ROW SUBMIT
                            echo "<meta http-equiv='refresh' content='0'>";
                        }
                
                 ?>

    Now i need to send an email and the function must be in the functions.php. What is the action i should use to send a mail with wp_mail.

    Thank you so much for your help!

Viewing 1 post (of 1 total)

The topic ‘Send mail from functions.php when row is added in fro’ is closed to new replies.