|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Web Coding | |
Needs help with emailer (php)
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
Case Modder
![]() |
Okay, so for a weekend project for my web design course we have to design a emailer. I pretty much have it done, I just need to get it to where I can use html in the message.
Heres my work: PHP Code:
__________________
PM ME FOR CONTACT
Antec 900 Mod (Cable Management)
|
|||||||||||||
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
Programmer
|
I'm not sure if this would be cheating, but.... Contact form Generator here
You can at least use the end code for ideas.. I think you are going to have to put the form entries into variables, and then you can build your message. example code: PHP Code:
__________________
92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this.
|
|||||||||||||
|
|
|
|
|
#3 (permalink) |
|
Networking Nut
![]() |
Just wrote this up. Look at it closely: no variables are saved, no output buffers are used (all in all overhead is reduced) and the code is clean all around. These are attributes you may want to have in your future code
![]() PHP Code:
Last edited by Lyoko : 09-06-09 at 06:04 PM Reason: Label typos |
|
|
|
|
|
#4 (permalink) | ||||||||||||||
|
Case Modder
![]() |
That looks much nicer, thanks for helping guys.
But yet, no HTML support works... A friend mentioned maybe trying to add these to the headers: Quote:
__________________
PM ME FOR CONTACT
Antec 900 Mod (Cable Management)
|
||||||||||||||
|
|
|
|
|
#5 (permalink) | |
|
Networking Nut
![]() |
Quote:
If so, you need a web server (Nginx, Lighty, Apache [either of the three will work, you only need one]) and PHP installed with the said page in the proper folder so it can be executed by the php interpreter when you access it. PHP is executed on the server side (not client side/by the browser [like javascript]) so it will not work if you just save the page and try to view it. Your friend probably thought that you already had your web server and php ready to go, but I am not sure how changing the content encoding and mime version would help the issue at all. Once you have installed the web server and php, save the code I previously posted to a file (index.php preferrably) and cut/paste it to your server's web root. Then, go to http://localhost/index.php and you should be up and running
Last edited by Lyoko : 09-06-09 at 06:22 PM Reason: Tutorial link was too much, just try apache. |
|
|
|
|
|
|
#6 (permalink) | ||||||||||||||
|
Case Modder
![]() |
No, dude, its being run off a webserver. Online.
Go host your script, and test it out. What you type is what you see. If you type: Quote:
__________________
PM ME FOR CONTACT
Antec 900 Mod (Cable Management)
|
||||||||||||||
|
|
|
|
|
#7 (permalink) | |
|
Programmer
|
Quote:
Code:
<html>
<head>
<title>Goodbye World!</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257" />
</head>
<body>
//Made by T.Sullivan
<?php
if (!isset($_POST["send"])) {
// no post data -> display form
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
//define the body of the message.
ob_start();
?>
<form method="POST" action="<?=$_SERVER['PHP_SELF'];?>">
To: <input type="text" name="to"><br>
From: <input type="text" name="sender"><br>
Subject: <input type="text" name="subject"><br>
Message:<br>
<textarea name="message" rows="10" cols="60" lines="20"></textarea>
<input type="submit" name="send" value="Send">
</form>
<?
} else {
// found post data .. deal with it
$from=$_POST['sender'];
// send mail
if (mail($_POST['to'], $_POST['subject'],$_POST['message'],"From: $from\n")){
// success
echo "Your mail was sent.";
} else {
// error
echo "Your email was not sent.";
}
}
?>
</body>
</html>
__________________
90% of statistics are made up on the spot. including this one.
|
|
|
|
|
|
|
#8 (permalink) | |
|
Networking Nut
![]() |
Quote:
I have uploaded the script to my web server and have pm'd you the link; it's working fine. |
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|