prefix.'Appointments'; //get_currentuserinfo(); $user=$current_user->user_login; $admin_email = get_option('email_address'); $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 = ""; $url=site_url(); /* 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 ".$user; $subjectPara1 = 'New appointment successfully booked on '.$dat.''; $subjectPara2 = 'Please click here to show Appointments !'; $subjectPara3 = 'Thank you'; $message = ''. ''. ''. 'Appointment notification'. ''. ''. ''. '
'. '
'. '

'.$subtitle.'

'. '

'.$subjectPara1.'

'. '

'.$subjectPara2.'

'. '

'.$subjectPara3.'

'. '
'. '
'. ''. ''; $subtitle=" Hi Admin"; $subjectPara1 = 'New appointment successfully added by '.$user.' User.'; //$subjectPara2 = 'Please click here to show Appointments !'; $subjectPara3 = 'Thank you'; $message1 = ''. ''. ''. 'Appointment notification'. ''. ''. ''. '
'. '
'. '

'.$subtitle.'

'. '

'.$subjectPara1.'

'. /*'

'.$subjectPara2.'

'.*/ '

'.$subjectPara3.'

'. '
'. '
'. ''. ''; /*EMAIL TEMPLATE ENDS*/ $to = $a; // give to email address $subject = 'New Appointment'; //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 .= "Reply-To: {$from}\r\n"; $headers1 = "Reply-To: {$to} \r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers1 .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; //echo $message1.'\n'; //echo $message; //die(); // 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); wp_mail($from,$subject,$message1,$headers1); ?>