Page 1 of 1
Is this possible?
Posted: Thu Apr 13, 2006 2:31 pm
by kidstark
hawleyjr | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I was wondering if this would actually mail anything..
Code: Select all
<?php
$email="testsup123@yahoo.com";
if (mail($email,"testsup","testsup"))
{
print "email sent to $email";
}
?>
I recently registed an account with imhosted.com and they told me my code is flawed so they gave me the above code to prove their servers are functioning properly.. Still haven't recieved anything. Am I wrong that the above code is completely worthless?
hawleyjr | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Thu Apr 13, 2006 2:35 pm
by hawleyjr
Yep, looks right to me. you may want to check your bulk folder...
Posted: Thu Apr 13, 2006 2:46 pm
by kidstark
hawleyjr wrote:Yep, looks right to me. you may want to check your bulk folder...
So you can use the mail function in a conditional statement? I didn't know that..
Posted: Thu Apr 13, 2006 2:55 pm
by hawleyjr
kidstark wrote:hawleyjr wrote:Yep, looks right to me. you may want to check your bulk folder...
So you can use the mail function in a conditional statement? I didn't know that..
http://us3.php.net/manual/en/function.mail.php
Return Values
Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.
Posted: Thu Apr 13, 2006 3:00 pm
by kidstark
ah i see.. well here is my code..
Code: Select all
<HTML>
<script language="javascript">
function goback()
{
history.back();
}
</script>
<?php
$theDATE = strftime ("%a %B %d, %Y :: %I:%M %p, %Z");
$x = 0;
if ($NAME == "") $x = 1;
if ($PHONE == "") $x=1;
if ($EMAIL == "") $x=1;
if ($TAXRATE == "") $x=1;
if ($TYPE_OF_PROPERTY == "") $x=1;
if ($LOCATION_PREFERENCE == "") $x=1;
if ($AMOUNT_TO_INVEST == "") $x=1;
if ($MONEY_AVAILABLE == "") $x=1;
if ($RETURN_RATE == "") $x=1;
if ($INTEREST_WILLING == "") $x=1;
if ($READY == "") $x=1;
if ($x == 1) {
echo "<font face='Arial, Helvetica, sans-serif' size='2' color='#333333'>You did not complete the form, please go back, thank you.";
echo "<br><br><FORM><INPUT TYPE='button' VALUE='ok' style='background-color:#cccccc; border-style:1px; font-size: 10px; color: #000000; font-family: arial' onClick='goback();'></FORM>";
}
else {
mail ("kidstark@msn.com", "AMG Commercial Investment Inquery", "$theDATE\n\nNAME: $NAME\nE-MAIL:$EMAIL\nPHONE:$PHONE\nTAX RATE: $TAXRATE\n\nDO YOU HAVE A REASON FOR INVESTING THAT MIGHT IMPACT THE TRANSACTION?\n$IMPACT_THE_TRANSACTION\n\nWHAT TYPE OF OF PROPERTY ARE YOU LOOKING FOR?\n$TYPE_OF_PROPERTY\n\nLOCATION PREFERENCE: $LOCATION_PREFERENCE\n\nAMOUNT OF MONEY TO INVEST: $AMOUNT_TO_INVEST\n\nMONEY AVAILABLE: $MONEY_AVAILABLE\n\nARE YOU WILLING TO PUT UP EARNEST MONEY?\n$PUT_UP_EARNEST_MONEY\n\nRETURN RATE: $RETURN_RATE\n\nINTEREST WILLING TO PAY: $INTEREST_WILLING\n\nIS THERE ANYONE ELSE INVOLVED IN MAKING THE DECISION?\n$ANYONE_ELSE\n\nWHEN WILL YOU BE READY TO INVEST?\n$READY");
echo "<font face='Arial, Helvetica, sans-serif' size='2' color='#000000'>Form sent successfully. Thank you $NAME.</font>";
echo "<br><br><FORM><INPUT TYPE='button' VALUE='ok' style='background-color:#CCCCCC; border-style:1px; font-size: 10px; color: #000000; font-family: arial' onClick=parent.location='index.htm';return true;'></FORM>";
}
?>
</HTML>
It works fine on my old server, but they are going out of business.. Why wouldn't it work on the new server? I'm totally lost..
Posted: Thu Apr 13, 2006 10:10 pm
by timvw
These days variables coming from a form end up in $_GET and $_POST (depending on the method used).
For your example you'd have to change your code int something like this:
Posted: Fri Apr 14, 2006 9:55 am
by Ambush Commander
kidstark wrote:So you can use the mail function in a conditional statement? I didn't know that..
Well, the thing is, just be can doesn't mean you should. Putting the function in the conditional can save line space, but generally actions inside conditionals can be confusing.