Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('../../../wp-blog-header.php');
- get_header();
- if ( isset( $_POST['afs-submitted'] ) ) {
- global $wpdb;
- $row = $wpdb->get_row("SELECT * FROM wp_asf_layout");
- $userName = sanitize_text_field( $_POST["asf-name"] );
- $userEmail = sanitize_email( $_POST["asf-email"] );
- $subject = $row->subject;
- $message = $row->message;
- $attachments = array( $row->files );
- $admin_email = $row->email_from;
- $headers = "From: $row->name_from <$admin_email>" . "\r\n";
- $new_url = add_query_arg( 'success', 1, get_permalink() );
- wp_redirect( $new_url, 303 );
- if ( wp_mail( $userEmail, $subject, $message, $headers, $attachments) ) {
- echo '<div>';
- echo '<p>Thanks for contacting</p>';
- echo '</div>';
- } else {
- echo 'An unexpected error occurred';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement