Is this possible?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kidstark
Forum Newbie
Posts: 3
Joined: Thu Apr 13, 2006 2:27 pm

Is this possible?

Post by kidstark »

hawleyjr | Please use

Code: Select all

,

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

,

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]
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Yep, looks right to me. you may want to check your bulk folder...
kidstark
Forum Newbie
Posts: 3
Joined: Thu Apr 13, 2006 2:27 pm

Post 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..
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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..
:roll: :roll: :roll:


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.
kidstark
Forum Newbie
Posts: 3
Joined: Thu Apr 13, 2006 2:27 pm

Post 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..
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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:

Code: Select all

if (!isset($_GET['NAME']) $x = 1;
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
Post Reply