PDA

View Full Version : How to get this email form working?



GoldenMerc
05-07-2010, 11:23 PM
Well i just baught a layout and its got a email function for people to apply for beta and it just doesn't seem to be working, apparently it gets your email to send their emails from via emails.txt although it doesn't seem to be working heres the codes;


</ul>
<form action="mail.php" method="post" id="form-email">
<p>
<input type="text" name="email" id="email" value="Please enter your e-mail address here to apply for beta!"/>
</p>
<p>
<input type="submit" name="submit" id="submit" value="" />
</p>
</form>

Then in email its just got my email and thats it?
+Rep for help x!

HotelUser
05-07-2010, 11:39 PM
<?php
mail('[email protected]', 'SMS2PAYPAL', "from {$_POST['email']}");
?>

Put that for mail.php

GoldenMerc
06-07-2010, 12:01 AM
That doesn't seem to work, heres all the codes

function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}



/*FORM validation and div changing*/
$(document).ready(function() {
$().click(function (ev) {
var $target = $(ev.target);
if( !$target.is("input") ) {
$("input#email").val('Please enter your e-mail address here to apply for beta');
}
});

$("#email").click(function() {
$("input#email").val('');
});

$("#submit").click(function() {
var email = $("input#email").val();
if(!isValidEmailAddress(email)){
$("input#email").focus();
$("input#email").val('Enter a valid e-mail');
return false;
}
});

/*form submit*/
$("form#form-email").submit(function() {
var email = $("input#email").val();
$.ajax({
url:'mail.php',
type:'post',
data: "email="+email,
success: function(msg){
if (msg==1)
$("input#email").val('Thank you, your application has been recieved');
else
$("input#email").val('Some trouble on sending');
}
});
return false;
});
/*end formsubmit*/
});


and then thats it, it just wont submit, what i want it to do is send me a email at [email protected] with the beta's application just the email address really. but it just doesn't seem to be working...

Trigs
06-07-2010, 12:47 AM
<?php
if($_POST['submit']) {
$email = htmlspecialchars($_POST['email']);
mail('[email protected]','subject','message' )
echo 'Thanks for signing up';
} else {
<form action="" method="post">
Enter your email here: <input type="text" name="email" /> <br />
<input type="submit" name="submit" value="Submit!" />
</form>
}
?>


Wouldn't it just be more effective if you created a mailing list instead since all you need is an email address?

HotelUser
06-07-2010, 12:52 AM
<?php
if($_POST['submit']) {
$email = htmlspecialchars($_POST['email']);
mail('[email protected]','subject','message' )
echo 'Thanks for signing up';
} else {
<form action="" method="post">
Enter your email here: <input type="text" name="email" /> <br />
<input type="submit" name="submit" value="Submit!" />
</form>
}
?>


Wouldn't it just be more effective if you created a mailing list instead since all you need is an email address?

Actually it would be:


<?php
if($_POST['submit']) {
$email = htmlspecialchars($_POST['email']);
mail('[email protected]','putYourSubjectHere ','their email address: '.$email)
echo 'Thanks for signing up';
} else {
<form action="" method="post">
Enter your email here: <input type="text" name="email" /> <br />
<input type="submit" name="submit" value="Submit!" />
</form>
}
?>

Trigs
06-07-2010, 01:03 AM
my bad on the errors in that code. try this:

http://totalbasketball.herobo.com/test/form.php
http://totalbasketball.herobo.com/test/form.phps

edit - tested + working. just add the regex and style

GoldenMerc
06-07-2010, 01:06 AM
says some trouble on sending with that one

Trigs
06-07-2010, 01:13 AM
What? Was there an error or something? BTW the form.php uses my email so you won't get it. I got it so it's working. Just use the source and change the info within mail();

GoldenMerc
06-07-2010, 01:19 AM
http://smstopaypal.com/
Yep i've changed it but it still says theirs problems :(

Trigs
06-07-2010, 01:41 AM
Where?

GoldenMerc
06-07-2010, 01:43 AM
On the form when you enter your email it says somethings not right

Trigs
06-07-2010, 01:48 AM
Screenshot?

GoldenMerc
06-07-2010, 01:56 AM
image is below
http://i47.tinypic.com/11lht08.jpg

Trigs
06-07-2010, 02:38 AM
Oh that's on the Javascript. I don't know JS so I can't help you with that.

GoldenMerc
06-07-2010, 04:16 AM
Is there no way i can work around without javascript?

Jack!
06-07-2010, 07:05 PM
post the submit bit of the source on that page

Apolva
06-07-2010, 10:10 PM
If the emails won't send, you should check with your host to see if there are any restrictions in place (ie. to prevent spam).

GoldenMerc
06-07-2010, 10:42 PM
I've tried another method as stated and its still not working look;


</ul>
<form method="POST"> <p>
<input type="text" name="email" id="email" value="Please enter your e-mail address here to apply for beta!"/>
</p>
<p>
<input type="submit" name="submit" id="submit" value="" />
</p>
</form>
</div>
</div>
</div>
<?php
isset($_POST["email"])

$email = $_POST["email"];
$error = "";

}
if($email == "") {
$error .= "<li>You did not enter your email address!</li>";
}
if($email != "" && !preg_match('/^[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+$/i', $email)) {
$error .= "<li>You did not enter a valid email address!</li>";
}

if($error != "") {
$errormessage = "<p>Your message wasn't sent because:<ul>";
$errormessage .= "$error";
$errormessage .= "</ul></p>";
echo $errormessage;
} else {
mail("[email protected]","Contact Us Message", $message, "From: ".$name." <".$email.">");
echo("<p>Message sent successfully!</p>");
exit();
}
}
?>

HotelUser
06-07-2010, 10:56 PM
Paste this into test.php and go to it. If you don't get an email then there's a problem with either your host or the address you're trying to receive mail on:

<?php
mail('[email protected]', 'test', "test email");
?>

GoldenMerc
06-07-2010, 11:00 PM
http://smstopaypal.com/test.php

Return-path: <[email protected] (https://smstopaypal.com:2096/3rdparty/squirrelmail/src/compose.php?send_to=smstopay%40cosmic.sawhosting.c om)>
Envelope-to: [email protected] (https://smstopaypal.com:2096/3rdparty/squirrelmail/src/compose.php?send_to=services%40smstopaypal.com)
Delivery-date: Tue, 06 Jul 2010 23:58:56 +0100
Received: from smstopay by cosmic.sawhosting.com with local (Exim 4.69)
(envelope-from <[email protected] (https://smstopaypal.com:2096/3rdparty/squirrelmail/src/compose.php?send_to=smstopay%40cosmic.sawhosting.c om)>)
id 1OWH6N-00013L-Vl
for [email protected] (https://smstopaypal.com:2096/3rdparty/squirrelmail/src/compose.php?send_to=services%40smstopaypal.com); Tue, 06 Jul 2010 23:58:55 +0100
To: [email protected] (https://smstopaypal.com:2096/3rdparty/squirrelmail/src/compose.php?send_to=services%40smstopaypal.com)
Subject: test
Message-Id: <[email protected]>
From: [email protected] (https://smstopaypal.com:2096/3rdparty/squirrelmail/src/compose.php?send_to=smstopay%40cosmic.sawhosting.c om)
Date: Tue, 06 Jul 2010 23:58:55 +0100

The email came through :)
So looks like the codings wrong on this submit email thing HMM

Trigs
07-07-2010, 02:17 AM
Like I said, it's the javascript.

Want to hide these adverts? Register an account for free!