This is what I have now. The variables defined at first are variables from a HTML form.
<?php $html = $_POST["html"]; $to = $_POST["email"]; $name = $_POST["name"]; $filename = "$name.html"; $Content = "$html"; $handle = fopen($filename, 'x+'); fwrite($handle, $Content); fclose($handle); echo "Your html document has been processed."; $subject = "Your HTML file!"; $body = "Hey there!,\n\nYour requested html file is attached. Thanks for using this service!/nPlease keep in mind that all user created files are deleted daily, so make sure you save your html file in a safe place. /n We hope to see you again soon!"; mail($to, $subject, $body) ?>
Doesn't work...
Offline
jji7skyline wrote:
This is what I have now. The variables defined at first are variables from a HTML form.
Code:
<?php $html = $_POST["html"]; $to = $_POST["email"]; $name = $_POST["name"]; $filename = "$name.html"; $Content = "$html"; $handle = fopen($filename, 'x+'); fwrite($handle, $Content); fclose($handle); echo "Your html document has been processed."; $subject = "Your HTML file!"; $body = "Hey there!,\n\nYour requested html file is attached. Thanks for using this service!/nPlease keep in mind that all user created files are deleted daily, so make sure you save your html file in a safe place. /n We hope to see you again soon!"; mail($to, $subject, $body) ?>Doesn't work...
What error does it give you?
Offline
nathanprocks wrote:
jji7skyline wrote:
This is what I have now. The variables defined at first are variables from a HTML form.
Code:
<?php $html = $_POST["html"]; $to = $_POST["email"]; $name = $_POST["name"]; $filename = "$name.html"; $Content = "$html"; $handle = fopen($filename, 'x+'); fwrite($handle, $Content); fclose($handle); echo "Your html document has been processed."; $subject = "Your HTML file!"; $body = "Hey there!,\n\nYour requested html file is attached. Thanks for using this service!/nPlease keep in mind that all user created files are deleted daily, so make sure you save your html file in a safe place. /n We hope to see you again soon!"; mail($to, $subject, $body) ?>Doesn't work...
What error does it give you?
No error, it just doesn't send an email to my email.
Do I need to install some sort of PHP plugin?
Offline
jji7skyline wrote:
nathanprocks wrote:
jji7skyline wrote:
This is what I have now. The variables defined at first are variables from a HTML form.
Code:
<?php $html = $_POST["html"]; $to = $_POST["email"]; $name = $_POST["name"]; $filename = "$name.html"; $Content = "$html"; $handle = fopen($filename, 'x+'); fwrite($handle, $Content); fclose($handle); echo "Your html document has been processed."; $subject = "Your HTML file!"; $body = "Hey there!,\n\nYour requested html file is attached. Thanks for using this service!/nPlease keep in mind that all user created files are deleted daily, so make sure you save your html file in a safe place. /n We hope to see you again soon!"; mail($to, $subject, $body) ?>Doesn't work...
What error does it give you?
No error, it just doesn't send an email to my email.
Do I need to install some sort of PHP plugin?
You don't need any plugin, i know that much... I haven't actually sent email via PHP though.
One thing I have never seen in PHP syntax before is this:
$filename = "$name.html"; $Content = "$html";
Offline
nathanprocks wrote:
jji7skyline wrote:
nathanprocks wrote:
What error does it give you?No error, it just doesn't send an email to my email.
Do I need to install some sort of PHP plugin?You don't need any plugin, i know that much... I haven't actually sent email via PHP though.
One thing I have never seen in PHP syntax before is this:Code:
$filename = "$name.html"; $Content = "$html";
All of that works. It's just the mail bit that's the problem...
The first line sets the file name to the value of the variable html and then appends .html. The content of the file is in the second line that just says that it is the content of the variable $html.
Offline
jji7skyline wrote:
nathanprocks wrote:
jji7skyline wrote:
No error, it just doesn't send an email to my email.
Do I need to install some sort of PHP plugin?You don't need any plugin, i know that much... I haven't actually sent email via PHP though.
One thing I have never seen in PHP syntax before is this:Code:
$filename = "$name.html"; $Content = "$html";All of that works. It's just the mail bit that's the problem...
The first line sets the file name to the value of the variable html and then appends .html. The content of the file is in the second line that just says that it is the content of the variable $html.
I thought is was like this:
$filename = $name . ".html"; $Content = $html;
Offline
Offline
logiblocs wrote:
What OS are you on?
PHP is OS independent.
Last edited by ProgramCAT (2012-02-29 01:36:33)
Offline
ProgramCAT wrote:
logiblocs wrote:
What OS are you on?
PHP is OS independent.
Yes, but if it helps...
I'm on Mac OSX 10.7.3 with Chrome 17.0.963.56.
PHP version 5.3.6
Offline
TRocket wrote:
is mail() returning true or false?
True, since it doesn't echo that mailing failed.
Offline
You forgot the semicolon after the mail statement.
Also, some minor things: You have /n instead of \n a couple times in the body text. Why not just set $content directly to $_POST["html"]?
Last edited by scimonster (2012-02-29 06:40:51)
Offline
scimonster wrote:
You forgot the semicolon after the mail statement.
Also, some minor things: You have /n instead of \n a couple times in the body text. Why not just set $content directly to $_POST["html"]?
This is what I have now... thanks for the help, but I still don't get any emails. Are you sure I don't have to make changes on the php.ini file to enable mail function? I'm on a Mac.
<?php $html = $_POST["html"]; $to = $_POST["email"]; $name = $_POST["name"]; $filename = "'.$name.'.html"; $handle = fopen($filename, 'x+'); fwrite($handle, $html); fclose($handle); echo "Your html document has been processed. </br></br> You will be redirected to your file ($name.html) in 3 seconds. </br></br> We delete all user files from our server daily, so to save your file, please download it by right clicking on the page and choosing 'Save As'."; $subject = "Your HTML file!"; $body = "$html"; mail($to, $subject, $body); echo '<META HTTP-EQUIV="Refresh" Content="3"; URL=http://jji7skyline.dyndns.org/userhtmlfiles/'.$name.'.html">'; exit; ?>
Offline
You may have to. Does it say it has emails enabled?
Offline
scimonster wrote:
You may have to. Does it say it has emails enabled?
Can't find anything like that...
Oh well...
Offline