Page 1 of 1

Help making E-mail work right on my page

Posted: Sun Mar 06, 2005 4:47 am
by philwill30
http://www.philwill30.smokyhosts.com

The above is my site, on the main page you will find an e-mail link. I can't get it to work, I want it to send e-mail to my account made with cpanel, but no matter what url i try, it dont work. Could someone please tell me what i need to type in the action input of the form to get it to work? Ill even paste the code used...

<FORM METHOD="POST" ACTION="http://www.philwill30.smokyhosts.com/ph ... n/sendmail">
<p align="center"><font color="#999966" size="4">
Name</font><font face="Rockwell"><INPUT TYPE="text" Name="name" SIZE="35">
</font>


<P align="center"><font color="#999966" size="4">
E-mail</font><font face="Rockwell"><INPUT TYPE="text" Name="mail" SIZE="35">
</font>
<P align="center"><font color="#999966" size="4">
Message</font><font face="Rockwell"><TEXTAREA NAME="Message" ROWS=8 COLS=70></TEXTAREA>
<P align="center"><INPUT TYPE="Submit"><INPUT TYPE=Reset></FORM>


I hope someone can help me....[/b][/url]

Posted: Tue Mar 08, 2005 4:30 am
by tanaka
I think the problem is that action link to sendmail. If you installed that manually probably it will work with PHP, not HTML.
If you go to "CGI Center" link on your cPanel you will find "CGI EMail". That one would work fine with HTML.
Follow its guide (http://web.mit.edu/wwwdev/cgiemail/user.html) and you'll receive thousands of emails from your site :wink:

Posted: Wed Mar 09, 2005 2:18 am
by philwill30
and how do i post with PHP? I only know HTML! I hadnt even heard of php till i joined here. I did read the guide, but i thought i was doing what it told me to. I honestly have no idea what to do!

Posted: Wed Mar 09, 2005 2:37 am
by philwill30
ok i finally figured out where to download the cgi-email.*smacks self in head* Now i just dont know what do with it when i install it, much less where to install it to....

ok i downloaded the GGI mail program, uploaded to my gnupg folder on the webspace, now what?

Posted: Wed Mar 09, 2005 2:44 pm
by tanaka
First of all you don't have to install anything else because CGI EMail is already installed in our servers.
Then here we go.
Create a .txt file with the e-mail address that will receive the form, subject and the keywords:

To: philwill30@philwill30.com
Subject: Things they say through my site

Name: [name]
E-mail: [mail]
Message: [message]


These names between brackets [] are the same input type names you are using in your form:
<INPUT TYPE="text" Name="name" SIZE="35">

In your form action you put
action="http://www.philwill30.smokyhosts.com/cg ... iemail/the directory your .txt is/your form txt name.txt"

That should work. Simple like that! :wink:

You can also add a success or thanking page that will appear just after submit:
For just a message put the following on your form. Remind you can change the value.
<INPUT TYPE="hidden" NAME="addendum" VALUE="Thank you!">

If you want to redirect to another page after submit put
<INPUT TYPE="hidden" NAME="success" VALUE="http://your page addess/something/you decide/">

Another thing I observed is that Rockwell font you are using. I don't know if you are aware that people will see this font on their browsers only if they have it installed on their computers. Otherwise they will see default fonts like Times New Roman and Arial.

Posted: Fri Mar 11, 2005 3:13 am
by philwill30
OMG! Its so beautiful!!!! Wipes tear from eye,

Thank you Tanaka! you have helped me more than you know! now my e-mail works! Yippee!!!!!!!

Posted: Fri Mar 11, 2005 3:36 am
by ELRocco
here is my version it has option to send email to as many people as you want

<?php
$email1 = "email 1";
$email2 = "email 2";
$from = stripslashes($_POST['email']);

if($_POST['emailwhich'] == 1){
$sendTo = $email1;
}
else if($_POST['emailwhich'] == 2){
$sendTo = $email2;
}

if($from){

$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);

$headers = "From: $from\n";
$headers .= "Content-type: text;\r\n";
mail($sendTo,$subject,$message,$headers);
header("location:http://www.yourdomain.com/thankyou.htm");*\\Put the location oh the page they will be transfered to here
exit;
}
else{
?>
<html>
<head>
<title>Contact us</title>
</head>
<body>
<h1>Contact Form</h1>
<form name="contact" action="<? echo $_SERVER['PHP_SELF']; ?>" method="POST">


Please use this form to contact us:</p>


Your e-mail will be sent to::

<select name="emailwhich">
<option value="1">name for email 1</option>
<option value="2">name for email 2</option>
</select></p>


Enter Your Email Address:

<input type="text" name="email" style="width:150px;"></p>


Enter Your Website:

<input type="text" name="subject" style="width:250px;"></p>


Enter Your Message:

<textarea name="message" cols="0" rows="0" style="width:300px;height;200px;"></textarea>
</p>
<input type="submit" value="Send Email">
<input type="reset" name="Reset" value="Reset">
<a>Copyright ELRocco of ELRocco.co.nr</a>
</form>
</body>
</html>
<?
}
?>