# PHP mailing script issues

**URL:** <https://forum.kirupa.com/t/php-mailing-script-issues/183062>\
**Category:** programming\
**Created:** [March 23, 2006, 3:01pm UTC](https://forum.kirupa.com/t/php-mailing-script-issues/183062 "2006-03-23T15:01:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter71](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@Peter71](https://forum.kirupa.com/u/Peter71)\
**Post date:** [March 23, 2006, 3:01pm UTC](https://forum.kirupa.com/t/php-mailing-script-issues/183062/1 "2006-03-23T15:01:12Z")

</div>

Hey, I am trying to get a form mailing script to work on my website, and I was not being successful. There is one that I have been using for the past couple years, but it appears to be incompatible with some servers that I am having to use. Anyway, I tried to write a new one based on some examples that I have found online and in books, but since I am basically a moron, I have been having a very frustrating time. Here is an example of the script that I am currently battleing:

> \<?php  
> $siteName = “[blah.com](http://blah.com)”;  
> $siteURL = “[http://www.blah.com](http://www.blah.com)”;  
> $siteContact = “[peter.groik.com](http://peter.groik.com)”;

```
$mailMessage = "
	Name: $firstName $lastName
	Phone: $phone
	Address: $address
	City: $city
	State: $state
	Zip: $zip";
	
// Build up email header fields
$mailFrom = "From: $siteName &lt;$siteContact&gt;";
$mailTo = "Peter Osborne &lt;peter@groik.com&gt;";
$mailSubject = "blah.com Contact Form";

// Send email
mail($mailTo, $mailSubject, $mailMessage, $mailFrom);

```

?\>

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![theflashdude](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@theflashdude](https://forum.kirupa.com/u/theflashdude)\
**Post date:** [March 23, 2006, 4:40pm UTC](https://forum.kirupa.com/t/php-mailing-script-issues/183062/2 "2006-03-23T16:40:39Z")

</div>

this is just a check that should be made before you code it:  
Does your web server allow you to send a php mail function?  
What I mean is, you need to make sure that your ‘php.ini’ file has all the correct settings, example: register\_globals = on.

The code itself looks fine.

---

<div class="post-metadata">

**Author:** ![Peter71](https://avatars.discourse-cdn.com/v4/letter/p/13edae/32.png) [@Peter71](https://forum.kirupa.com/u/Peter71)\
**Post date:** [March 23, 2006, 4:42pm UTC](https://forum.kirupa.com/t/php-mailing-script-issues/183062/3 "2006-03-23T16:42:13Z")

</div>

Cool. I will have to ask the guy who is hosting it. Unfortunately I don’t have access to that info, but I will send him a note and see if I can look into it. I just wanted to make sure my code was peachy. Thanks again!

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 23, 2006, 4:44pm UTC](https://forum.kirupa.com/t/php-mailing-script-issues/183062/4 "2006-03-23T16:44:19Z")

</div>

code looks fine. Alot of Hosting services turn the mail() function off to avoid people using their servers to spam.

---

<div class="post-metadata">

**Author:** ![theflashdude](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@theflashdude](https://forum.kirupa.com/u/theflashdude)\
**Post date:** [March 23, 2006, 4:53pm UTC](https://forum.kirupa.com/t/php-mailing-script-issues/183062/5 "2006-03-23T16:53:24Z")

</div>

yeah that’s what i meant. My brother has his own hosting company & I host on it. I created a similar php mail() form & realised he had turned off the function in a php.ini file.
