Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,149,946 members, 7,806,740 topics. Date: Tuesday, 23 April 2024 at 10:15 PM

@Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct (1957 Views)

Help To Correct This Php Mailer Code / Who Knows The Script Used Here / *~Yawa-ti-de Voted Webmasters Section Poster Of The Year 2012*~Congratulations (2) (3) (4)

(1) (Reply) (Go Down)

@Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 8:13am On Jan 16, 2013
<?php
$emailSubject = 'Customer Has a Question!';
$webMaster = 'raylight4lyf63@gmail.com';

$surnameField = $_POST ['surname'];
$othernamesField = $_POST ['othernames'];
$sexField = $_POST ['sex'];
$organisationField = $_POST ['organisation'];
$telField = $_POST ['tel'];
$emailField = $_POST['email'];
$addressField = $_POST ['address'];
$messageField = $_POST ['message'];

$body = <<<EOD
<br><hr><br>
Surname: $surname <br>
Othernames: $othernames <br>
Sex: $sex <br>
Organisation: $organisation <br>
Tel: $tel <br>
Email: $email <br>
Address: $address <br>
Message: $message <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";

$success = mail($webMaster, $emailSubject, $body, $headers);

$theResults = <<<EOD
<font style="font-size:15px;font-weight:bold;font-family:georgia;"><p>Thank you for taking time to send us a mail. It has been received and we will get back to you shortly.</p>
<p>
Thanks.</p><br>
<a href="http://www.facebook.com/dxceller" style="color:blue;">Webmaster</a> for God's Grace Computers</font>
EOD;

echo "$theResults";
?>


<form action="form_mailer.php" method="post">
<table>
<tr>
<td>Upload MSWord document<br />if required:</td>
<td><input type="file" label="file" id="file" accept="application/msword" height="151" width="132" /></td>
</tr>
<tr>
<td>Surname:</td>
<td><input type="text" label="surname" id="surname" /></td>
</tr>
<tr>
<td>Othernames:</td>
<td><input type="text" label="othernames" id="othernames" /></td>
</tr>
<tr>
<td>Sex(M/F):</td>
<td><input type="text" label="sex" id="sex" maxlength="1" /></td>
</tr>
<tr>
<td>Organisation:</td>
<td><input type="text" label="organisation" id="organisation" /></td>
</tr>
<tr>
<td>Tel:</td>
<td><input type="text" label="tel" id="tel" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" label="email" id="email" /></td>
</tr>
<tr>
<td>Address:</td>
<td><input type="text" label="address" id="address" /></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea cols="50" rows="8" id="message" label="message" /></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>max message length is 400</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Send Mail" /></td>
</tr>
</table>
</font>
</form>
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 9:57am On Jan 16, 2013
webmasters in the house pls answer me.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by yawatide(f): 10:47am On Jan 16, 2013
Have you ran this? If so, what are you getting?
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 11:30am On Jan 16, 2013
when i used my system without a server it showed some things like this

Surname: $surname <br>
Othernames: $othernames <br>
Sex: $sex <br>
Organisation: $organisation <br>
Tel: $tel <br>
Email: $email <br>
Address: $address <br>
Message: $message <br>
Thank you for taking time to send us a mail. It has been received and we will get back to you shortly.</p>
<p>
Thanks.
EOD;

but when i used wampserver it responded fine but showed an error comment before the confirmation text.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by tcubed03: 11:30am On Jan 16, 2013
Why did you store the mail(...) in variable $success, you myay just try
mail($webMaster, $emailSubject, $body, $headers); (without assigning it to a variable, and lets see how it works)
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 11:35am On Jan 16, 2013
ok
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 11:43am On Jan 16, 2013
this is the actual error message i got when i used wampserver

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 255, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\site\form_mailer.php on line 55

please, how do i resolve this. or is it working?
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 11:49am On Jan 16, 2013
@tcubed03: i got the same result
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Gerardcole(m): 2:30pm On Jan 16, 2013
My WAMP server doesn't send mails even when I'm connected.

For mail function. Upload this file and run it online. Cos mine works when uploaded but never sends on WAMP and I ve never tried to debug.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 2:59pm On Jan 16, 2013
Can u pls help me run it even for less a day. I hope to have a domain name by next week but for now i've got none. Pls.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by DualCore1: 3:36pm On Jan 16, 2013
I didn't bother to read through your code since you have posted the error you are getting.
You are getting that error because you have not configured your local webservers SMTP settings.

Note that you will not get that particular error when you run your code online. So assuming there's no other problem with your code, there is nothing to worry about as it will work when you place it online.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 3:52pm On Jan 16, 2013
K. Thank u.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by sisqology(m): 5:23pm On Jan 16, 2013
Forget about the error. It will work online. Its irrelevant.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by 53cur3m0d3(m): 6:05pm On Jan 18, 2013
This Raylight guy no go kee Yawatide for us o. Such a fast and passionate learner dis guy is.

1 Like

Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by yawatide(f): 8:16pm On Jan 18, 2013
^^^ he he, maybe i need to start purposely arriving at posts late. By then, the problem will be resolved tongue
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 6:51am On Jan 19, 2013
One thing I wish is getting to know this thing just as you guys do.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by Raylight2(m): 1:10pm On Jan 20, 2013
Please o, this code sends me a blank message. Pls, help me correct it.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by 53cur3m0d3(m): 2:41am On Jan 21, 2013
yawa-ti-de:
^^^ he he, maybe i need to start purposely arriving at posts late. By then, the problem will be resolved tongue
U'd beta not try it else guys 'll com and rent 1 room & parlour facing ur house.
Re: @Yawa-ti-de:Please Help Me Check This PHP Mailer To See If The Script Is Correct by yawatide(f): 12:00pm On Jan 21, 2013
^^^ LOL

(1) (Reply)

Cheapest .com.ng Domain And .com.ng WHMCS Module / Lovingdomains.com Is Shutting Down / Please Teach Me How To Create A Good Php Site

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 25
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.