Jump to content

Recommended Posts

I am working on a site and for some reason the mail function keeps returning false for no reason when all the input is correct and should be sending, the script is below.

 

<?php

//If form submitted.
					if(isset($_POST['name']) && isset($_POST['url']) && empty($_POST['agree'])) {
						//Get/set vars.
						$name = $_POST['name'];
						$url = $_POST['url'];
						$perms = $_POST['perms'];
						$subject = "Pleasing Page Submission";
						$to = "luke@lszanto.hosttds.com";
						$from = "From: <Pleasing Pages>";

						//Check for perms.
						if($perms == "on") {
							$perms = "You have owners permission.";
						} else {
							$perms = "You need to contact the owner and get permission.";
						}

						//Make email.
						$message = "You have recieved a page that has pleased $name\n\nName: $name\nPleasing Page: $url\nPermission: $perms\n\nThanks, Pleasing Pages";

						//Make mail var.
						$mail = mail($subject, $to, $message, $from);

						//Check if sent.
						if($mail) {
							//Sent.
							echo "$url has been sucessfully submitted.";
						}  else {
							//Didn't send.
							echo "An error has occured, please go <a href=\"http://lszanto.hosttds.com/wordpress/please-us/\" >back</a> and try again.";
						}
					} else {
						echo "<script> window.location = 'http://lszanto.hosttds.com'; </script><noscript><meta http-equiv=\"refresh\" content=\"0;url=http://lszanto.hosttds.com\" /></noscript>";
					}

?>

Link to comment
https://forums.phpfreaks.com/topic/72057-solved-unknown-mail-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.