WordPress.org

Ready to get started?Download WordPress

Forums

Contact form not working... (1 post)

  1. sofielyr
    Member
    Posted 3 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