View previous topic :: View next topic |
Author |
Message |
razorsedge -
Joined: 06 Jan 2007 Posts: 104
|
Posted: Wed Jan 10, 2007 7:47 am Post subject: php mailer issue--- simple script |
|
|
k i wrote this script myself and i remember it working on another server but now when i put iton mine, i do not know why it will not email myself.
The htm file looks like:
Code: | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Welcome to the Alumni Contact Information Page!</title>
</head>
<body>
<form method="POST" action="mailer.php">
<h1><center><b>Alumni Contact Information</b></center></h1>
<center>
Please just take a couple of minutes and fill out this form so we can keep our Alumni Database Up-to-Date.Thankyou!If you have any trouble viewing this page please contact the Alumni Officer at: blahb@mtsu.edu Also Currently some of the fields are having trouble recieving some of the information, so until we have a solution for the problem expect a phone call from you Alumni Officer.
</center>
<br>
<center>ID Number(If known):<br>
<input type="text" name="id_number" size="19"><br>
First Name:<br>
<input type="text" name="first_name" size="19"><br>
Middle Name:<br>
<input type="text" name="middle_name" size="19"><br>
Last Name:<br>
<input type="text" name="last_name" size="19"><br>
Address:<br>
<input type="text" name="address" size="35"><br>
City: <br>
<input type="text" name="city" size="19"><br>
State:<br>
<select name = "sel_State">
<option value ="Alabama">Alabama</option>
<option value ="Alaska">Alaska</option>
<option value ="Arizona">Arizona</option>
<option value ="Arkansas">Arkansas</option>
<option value ="California">California</option>
<option value ="Colorado">Colorado</option>
<option value ="Connecticut">Connecticut</option>
<option value ="Delaware">Delaware</option>
<option value ="Florida">Florida</option>
<option value ="Georgia">Georgia</option>
<option value ="Hawaii">Hawaii</option>
<option value ="Idaho">Idaho</option>
<option value ="Illinois">Illinois</option>
<option value ="Indiana">Indiana</option>
<option value ="Iowa">Iowa</option>
<option value ="Kansas">Kansas</option>
<option value ="Kentucky">Kentucky</option>
<option value ="Louisiana">Louisiana</option>
<option value ="Maine">Maine</option>
<option value ="Maryland">Maryland</option>
<option value ="Massachusetts">Massachusetts</option>
<option value ="Michigan">Michigan</option>
<option value ="Minnesota">Minnesota</option>
<option value ="Mississippi">Mississippi</option>
<option value ="Missouri">Missouri</option>
<option value ="Montana">Montana</option>
<option value ="Nebraska">Nebraska</option>
<option value ="Nevada">Nevada</option>
<option value ="New Hampshire">New Hampshire</option>
<option value ="New Jersey">New Jersey</option>
<option value ="New Mexico">New Mexico</option>
<option value ="New York">New York</option>
<option value ="North Carolina">North Carolina</option>
<option value ="North Dakota">North Dakota</option>
<option value ="Ohio">Ohio</option>
<option value ="Oklahoma">Oklahoma</option>
<option value ="Oregon">Oregon</option>
<option value ="Pennsylvania">Pennsylvania</option>
<option value ="Rhode Island">Rhode Island</option>
<option value ="South Carolina">South Carolina</option>
<option value ="South Dakota">South Dakota</option>
<option value ="Tennessee">Tennessee</option>
<option value ="Texas">Texas</option>
<option value ="Utah">Utah</option>
<option value ="Vermont">Vermont</option>
<option value ="Virginia">Virginia</option>
<option value ="Washington">Washington</option>
<option value ="West Virginia">West Virginia</option>
<option value ="Wisconsin">Wisconsin</option>
<option value ="Wyoming">Wyoming</option>
</select>
<br>
Zip Code:<br>
<input type="text" name="zip_code" size="19"><br>
Initiation Date(If Known):<br>
<input type="text" name="iniation_date" size="19"><br>
Email:<br>
<input type="text" name="email" size="19"><br>
Preferrable Phone Number:<br>
<input type="text" name="preferrable_phone_number" size="19"><br>
Secondary Phone Number:<br>
<input type="text" name="secondary_phone_number" size="19"><br>
Thankyou for taking time to complete this form!<br><br>
<input type="submit" value="submit" name="submit">
</center>
</body>
</html>
|
then the php file.. or the mailer file which actually mails it 2 wherever i am requesting looks like so:
Code: | <?php
if(isset($_POST['submit'])) {
$to = "extremebondagent@earthlink.net";
$from ="extremebondagent@earthlink.net";
$subject = "Alumni Contact Information";
$id_number = $_POST['id_number'];
$first_name = $_POST['first_name'];
$middle_name = $_POST['middle_name'];
$last_name = $_POST['last_name'];
$address = $_POST['address'];
$city = $_POST['city'];
$sel_State = $_POST['sel_State'];
$zip_code = $_POST['zip_code'];
$initiation_date = $_POST['zip_code'];
$email = $_POST['email'];
$preferrable_phone_number = $_POST['preferrable_phone_number'];
$secondary_phone_number = $_POST['secondary_phone_number'];
$body = "From: $last_name, $first_name\n ID Number: $id_number\n First Name: $first_name\n Middle Name: $middle_name\n Last Name: $last_name\n Address: $address\n City: $city\n State: $sel_State\n Zip Code: $zip_code\n Iniation Date: $iniation_date\n Email: $email\n Preferrable Phone Number: $preferrable_phone_number\n Secondary Phone Number: $secondary_phone_number";
echo "Data has been submitted to $to! Thankyou for your time.";
mail($to, $from, $subject, $body);
} else {
echo "blarg!";
}
?> |
after i hit submit on the alumnicontacts page i get this error:
Code: | Data has been submitted to extremeuniqueagent@earthlink.net! Thankyou for your time.
Warning: mail() [function.mail]: SMTP server response: 501 <, >: missing or malformed local part in C:\Program Files\Abyss Web Server\htdocs\ATO\mailer.php on line 22 |
Also the code that is setup in my php.ini file that is located in my C:/Windows file and in my php5 folder looks like so:
i have made sure the port was correct and i have also made sure the smtp server is correct ... which they are! how come i keep getting this error? plz help me... also the server is an auth server so maybe i must put my username and password if so , how would i do that?
Last edited by razorsedge on Wed Jan 10, 2007 5:19 pm; edited 2 times in total |
|
Back to top |
|
|
Marty -
Joined: 10 Sep 2006 Posts: 83
|
Posted: Wed Jan 10, 2007 11:57 am Post subject: |
|
|
error 501 is an invalid email address.
Open php.ini
Remove the semicolon ;
PS: Thats just one thing I noticed, it may still give you error, but at least your php.ini file will be correctly set.
*I edited your email address in the example because you should never post an email address on Forums, it leaves it open to bots, with the result you will get loads of spam in your mail box. _________________ www.web-bin.com | www.skydigitalcards.com |
|
Back to top |
|
|
razorsedge -
Joined: 06 Jan 2007 Posts: 104
|
Posted: Wed Jan 10, 2007 4:56 pm Post subject: |
|
|
we have an automatic spam thing so it deletes it for me.. thank the lord!but i wont do it again ... and i'll edit my email rite now |
|
Back to top |
|
|
razorsedge -
Joined: 06 Jan 2007 Posts: 104
|
Posted: Wed Jan 10, 2007 5:07 pm Post subject: |
|
|
k now i get a different error code.... plz someoe help. i am also gonna get the original mailer.php and see if that will work but the code i am getting rite now is:
Code: | Data has been submitted to extremeniqueagent@earthlink.net! Thankyou for your time.
Warning: mail() [function.mail]: SMTP server response: 550 Please configure your mail client to use authentication. in C:\Program Files\Abyss Web Server\htdocs\ATO\mailer.php on line 22
|
Like i said it needs configuration for authentication. How mite i go about doing this? anyone know?would i just put in the php.ini file as follows:
Code: | username=?????
password=????
|
|
|
Back to top |
|
|
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Wed Jan 10, 2007 5:31 pm Post subject: |
|
|
You cannot use SMTP Auth without a php script with a function to do it for you. The php.ini doesn't support SMTP Auth in any way what-so-ever. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
|
razorsedge -
Joined: 06 Jan 2007 Posts: 104
|
Posted: Wed Jan 10, 2007 5:36 pm Post subject: |
|
|
k so i will have 2 include it in my mailer.php
umm... yeah i'm not so good with that i mtie use another smtp.somethin.net |
|
Back to top |
|
|
razorsedge -
Joined: 06 Jan 2007 Posts: 104
|
Posted: Wed Jan 10, 2007 9:05 pm Post subject: |
|
|
k i have no other smtp that i can try.. can someone plz help me configure the mailer where i can use smtp auth inside of it... is there a way? plz help! if you kno a way |
|
Back to top |
|
|
hc2995 -
Joined: 07 Aug 2006 Posts: 644 Location: Maryland, USA
|
Posted: Thu Jan 11, 2007 8:48 pm Post subject: |
|
|
razorsedge.
I just found out that you can not authenticate using the php mail(); function. Iv found some documentation that may or may not help. Sorry i couldnt help with your script (i never had to worry about authentication :/) Anyway here is the link:
http://news.php.net/article.php?group=php.general&article=130351 _________________ Where have i been? School got heck-tick, had to move half way around the state, then back... and then i had to change jobs, so iv been away for a while :P |
|
Back to top |
|
|
razorsedge -
Joined: 06 Jan 2007 Posts: 104
|
Posted: Thu Jan 11, 2007 9:11 pm Post subject: |
|
|
thanks man! |
|
Back to top |
|
|
lestat -
Joined: 15 Sep 2003 Posts: 130 Location: GREEN BAY
|
Posted: Wed Aug 29, 2007 6:01 pm Post subject: |
|
|
Sending via mail() can be tricky due to header configuration semantics.
However the phpMailer class has a lot of built in stuff to take having to know all that stuff out of the equation. It allows using SMTP, as well as sending HTML in mail bodies.
Good luck to ya. _________________ XP Pro sp2
Abyss Web Server X2 (v 2.9.3.5)
PHP 5.3.8 |
|
Back to top |
|
|
rrinc -
Joined: 24 Feb 2006 Posts: 725 Location: Arkansas, USA
|
Posted: Wed Aug 29, 2007 9:52 pm Post subject: |
|
|
SwiftMailer is better... >:D _________________ -Blake | New Server :D
SaveTheInternet
Soy hispanohablante. Puedes contactarme por mensajes privados. |
|
Back to top |
|
|
|