prefix.'Appointments'; $userid=$_REQUEST['userid']; $username = $wpdb->get_var("SELECT user_login FROM {$wpdb->users} WHERE ID = '{$userid}'"); get_currentuserinfo(); $user=$current_user->user_login; $admin_email = get_option('admin_email'); $lastId = $wpdb->get_var("SELECT max(appointment_id) FROM $table"); // Get last inserted id $res=$wpdb->get_results("SELECT * from $table WHERE appointment_id='".$lastId."'"); foreach($res as $val){ $a=$val->email_id; $dat=$val->date_of_apointment; } $path = $this->options['upload_image']; $img = ""; /* Change your message body in the given $subjectPara variables. $subjectPara1 means 'first paragraph in message body', $subjectPara2 means'first paragraph in message body', if you don't want more than 1 para, just put NULL in unused $subjectPara variables. */ $subtitle="Hi Admin"; $subjectPara1 = 'You are successfully approved appointment of User '.$username.'!'; $subjectPara3 = 'Thank you'; $message = ''. ''. ''. 'Email notification'. ''. ''. ''. '
'. '
'. '

'.$subtitle.'

'. '

'.$subjectPara1.'

'. '

'.$subjectPara3.'

'. '
'. '
'. ''. ''; /*EMAIL TEMPLATE ENDS*/ $to = $admin_email; // give to email address $subject = 'Appointment approved'; //change subject of email $from = $admin_email; // give from email address // mandatory headers for email message, change if you need something different in your setting. $headers = "From: " . $from . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; //die($message); // Remember, mail function may not work in PHP localhost setup but the email template can be used anywhere like (PHPmailer, swiftmailer, PHPMail classes etc.) // Sending mail wp_mail($to, $subject, $message, $headers); ?>