# PHP Mailform... only sending to internal addresses?

**URL:** <https://forum.kirupa.com/t/php-mailform-only-sending-to-internal-addresses/223528>\
**Category:** programming\
**Created:** [April 23, 2007, 4:35pm UTC](https://forum.kirupa.com/t/php-mailform-only-sending-to-internal-addresses/223528 "2007-04-23T16:35:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![woodman650](https://avatars.discourse-cdn.com/v4/letter/w/b9bd4f/32.png) [@woodman650](https://forum.kirupa.com/u/woodman650)\
**Post date:** [April 23, 2007, 4:35pm UTC](https://forum.kirupa.com/t/php-mailform-only-sending-to-internal-addresses/223528/1 "2007-04-23T16:35:23Z")

</div>

Hey all,  
I’m completely and hopelessly perplexed with a mailform I’ve created. I followed many tutorials but I have one huge problem… the mail only goes to an internal address.

I have a field on the form where a user enters their email and they are supposed to receive a confirmation email… but the email only sends to internal addresses.

The second problem is that there is supposed to be an email sent with all the form details to [email@here.com](mailto:email@here.com) or whatever, and it will only send if the email address entered in the field matches. So, for example, entering [email2@here.com](mailto:email2@here.com) in the field won’t send the admin an email… only by entering [email@here.com](mailto:email@here.com) will it go through. any ideas? I’m totally confused. thanks

Woody

OH, here is some code…

```php
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= "From: $field1 $field2 <$field12>" . "
";
 
$header = 'MIME-Version: 1.0' . "
";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$header .= "From: $recipientname <$recipientemail>" . "
";
// send mail to admin and print success message
mail($recipientemail, $subject, $message, $headers);
 
// send mail to user as either html or plain text
if ($autoresponse == "yes") {
    if ($field14 == "HTML") {
        $autosubject = stripslashes($autosubject);
        $automessagehtml = stripslashes($automessagehtml);
        mail($field12,"$autosubject","$automessagehtml", "$header");
    } else {
        $autosubject = stripslashes($autosubject);
        $automessage = stripslashes($automessage);
        mail($field12,"$autosubject","$automessage", "From: $recipientname <$recipientemail>");
    }
}

```
