Page 1 of 2
Email Frustrations
Posted: Sun Sep 15, 2002 8:54 pm
by dgarrett
I am atempting to get this code to work, it takes variables from flash, and emails them to me from the flash form. The problem after my six hour trial and error debugging, I believe has nothing to do with flash, but is this php. The flash simply sends the varaibles to this php code that is not mailing.
My theroy is it must be somthing to do with my quotes or some syntax trouble. If I use a very basic mail() without variables it works, but what good is that really. Thanks in advance for any tips here is the loosing code:
Code: Select all
<?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Dustin";
$ToSubject = "New Remedy Motel Mailing List Entry";
$EmailBody = "'Sent By:' $FirstName 'Senders Email:' $Email 'Address:' $Address";
//$EmailFooter="This message was sent by: $FirstName If you feel that you
//recieved this e-mail by accident please contact us at www.whitedotgroup.com";
//$Message = $EmailBody
//.$EmailFooter;
mail($ToName." <".$ToEmail.">", $ToSubject, $EmailBody, "From: ".$FirstName." <".$Email.">");
Print "_Root.Mail.EmailStatus=Complete - Your mail has been sent";
Posted: Mon Sep 16, 2002 2:34 am
by Takuma
Code: Select all
<?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Dustin";
$ToSubject = "New Remedy Motel Mailing List Entry";
$EmailBody = "Sent By: $FirstName\n Senders Email: $Email\n Address: $Address";
mail($ToName." <".$ToEmail.">", $ToSubject, $EmailBody, "From: ".$FirstName." <".$Email.">");
Print "_Root.Mail.EmailStatus=Complete - Your mail has been sent";
?>
Try this and if you do this
Code: Select all
<?php
mail("YOURADDRESS","SUBJECT","MESSAGE");
?>
Does it work? If it doesn't there's something wrong with our PHP try editing php.ini.
Posted: Mon Sep 16, 2002 3:00 am
by twigletmac
Since the data is coming from a form, have you read this:
http://www.devnetwork.net/forums/viewtopic.php?t=511
Mac
Posted: Mon Sep 16, 2002 11:26 am
by dgarrett
OK Thanks for the advice, I skimmed throught the forms primer, it looks as this won't apply to me because I am using 4.1. It seems so simple. I used the same code, which it close to what I came up with after re-reading the first three chapters of my php book. But still it does not work... If anyone it stil interested in this annomoly here is continued saga:
The code is as follows:
Code: Select all
<?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Dustin";
$ToSubject = "New Remedy Motel Mailing List Entry";
$EmailBody = "Sent By: $FirstName\n Senders Email: $Email\n Address: $Address";
mail($ToName." <".$ToEmail.">", $ToSubject, $EmailBody, "From: ".$FirstName." <".$Email.">");
Print "_Root.Mail.EmailStatus=Complete - Your mail has been sent";
?>
Here is what I have used to pass the variables to take flash out of the loop
Code: Select all
http://remedymotel.com/pages/dust_mail.php?FirstName=rudy&Address=brier&Email=tooty
And the result is
Warning: Server Error in U:\users\r\remedy\pages\dust_mail.php on line 8
_Root.Mail.EmailStatus=Complete - Your mail has been sent
Line 8 Being the mail page the problem, Now if I remove the $EmailBody variable and change it to a string ie "test".
the result is this, as it should work
_Root.Mail.EmailStatus=Complete - Your mail has been sent
But sadly no email is recieved... I Am at a loss here
FYI this does work
Code: Select all
<?php
mail("to","subject","body");
?>
Thanks Again Dustin
Posted: Mon Sep 16, 2002 11:36 am
by Takuma
Code: Select all
<?php
$ToEmail = "dustingarrett@yahoo.com";
$ToName = "Dustin";
$ToSubject = "New Remedy Motel Mailing List Entry";
$EmailBody = "Sent By: {$_GETї'FirstName']}\n Senders Email: {$_GETї'Email']}\n Address: $_GETї'Address']}";
$ToEmail = $ToName." <".$ToEmail.">";
$from = "From: ".$_GETї'FirstName']."<".$Email.">";
mail($ToEmail, $ToSubject, $EmailBody,$from);
Print "_Root.Mail.EmailStatus=Complete - Your mail has been sent";
?>
How about this?
Posted: Mon Sep 16, 2002 12:16 pm
by dgarrett
Now I get this:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in U:\users\r\remedy\pages\dust_mail.php on line 6
I don't know this also seems as if it should work, thanks for the help, I don't blaim you if you want to give up, this seems so rudamentary.
Posted: Mon Sep 16, 2002 12:34 pm
by dusty
{$_GET['Address']} in the email body. you forgot the opening {
Posted: Mon Sep 16, 2002 12:43 pm
by dgarrett
Now this:
Warning: Server Error in U:\users\r\remedy\pages\dust_mail.php on line 11
_Root.Mail.EmailStatus=Complete - Your mail has been sent
I sort of keeping a log here to show my hosting company to see if they have any comments on the matter. Again thank you
Posted: Mon Sep 16, 2002 1:13 pm
by dusty
i'm guessing you're on a windows server and smtp isn't set in php.ini
Posted: Mon Sep 16, 2002 2:34 pm
by dgarrett
It is on a windows server, but I believe the mail is configured beacause this function works as long as there are no variable involved.
Code: Select all
<?php
mail("YOURADDRESS","SUBJECT","MESSAGE");
?>
This is becoming tiresome, if I can't get this to work I'm starting to think I'm doomed... SOmthing must be fishey here, as the code others have posted looks perfect to me?

Posted: Mon Sep 16, 2002 5:09 pm
by Takuma
If you change YOURADDRESS to your real-email address does it sends an e-mail to you?
Posted: Mon Sep 16, 2002 6:45 pm
by dgarrett
It does not, it give me a serve error:
Warning: Server Error in U:\users\r\remedy\pages\dust_mail.php on line 11
_Root.Mail.EmailStatus=Complete - Your mail has been sent
But if I take out all variable and just use text it does work? Wierd. Thenks for all the effort
Posted: Mon Sep 16, 2002 7:01 pm
by hob_goblin
i'd try doing some error checking like;
right before the mail() function to see what you're emailing.
Posted: Mon Sep 16, 2002 7:05 pm
by dgarrett
good tip i'll giv it a go.
Posted: Mon Sep 16, 2002 7:49 pm
by dgarrett
So it seems as if the variables are set as seen in a not so pretty mannor here:
ToEmail: Dustin ToName: Dustin ToSubject: New Remedy Motel Mailing List Entry EmailBody: Sent By: rudy Senders Email: tooty Address: brier From: From: rudy
Warning: Server Error in U:\users\r\remedy\pages\dust_mail.php on line 16
_Root.Mail.EmailStatus=Complete - Your mail has been sent
you can check out the phpinfo at
http://www.remedymotel.com/pages/phpinfo.php
if that will help anyone with ideas, but it does work as long as I enter a actual string "sample", for the toemail, and body, it will actually send with the toemail variable when is is simplified to just a plain email address....