WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Contact form not working... (1 post)

  1. sofielyr
    Member
    Posted 5 years ago #

    Hi, I would really appreciate if someone could have a look at the following code to see if it is correct. My contact form doesn't seem to work as the emails don't get forwarded to my email address (adim email in wordpress).
    I have a feeling that it has something to do with an update in wordpress. Please help!

    <?php
    		require("../../../../wp-load.php"); //required to include wordpress file
    		GLOBAL $shortname;
    		$mailTo = get_option($shortname.'_contact_admin_email');
    		$name = $_POST['name'];
    		$mailFrom = $_POST['email'];
    		$subject = $_POST['subject'];
    		$message = $_POST['message'];
    
    		$headers = "From: $mailFrom";
    		$subject = $subject." - A message from ".get_option('siteurl');
    		$body = "Name: $name\n\n"
    			. "Email: $mailFrom\n\n"
    			. "Subject: $subject\n\n"
    			. "Message: \n$message"
    			;
    		$Send_Email = (mail($mailTo, $subject, $body, $headers));
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic