PHP send_mail help needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TurboMatt
Forum Newbie
Posts: 1
Joined: Mon Dec 15, 2008 5:37 pm

PHP send_mail help needed

Post by TurboMatt »

edit: premature posting. I did not resolve the issue as I thought.

Anyway, I have a website hosted on Yahoo! and it appears that my PHP scripting is not supported on their end. Yahoo requires a 'from' section in the php script that is a e-mail address in your domain. I have a send_mail.php file that came with a template that I purchased. The developement company hosted it temporarily on their web server and it works perfect. When I upload the site to yahoo, the php contact page will not work.

Here is the send_mail.php script. Note - I changed my domain from the real domain to to mydomain.

<?php
$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];

if( $contact_name == true )
{
$sender = $contact_email;
$receiver = "help@Mydomain.net";
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip \nMydomain Email System";
$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();

if( mail( $receiver, "Mydomain Support Form - $subject", $email_body, $extra ) )
{
echo "success=yes";
}
else
{
echo "success=no";
}
}
?>
User avatar
phpserver
Forum Newbie
Posts: 22
Joined: Mon Oct 20, 2008 2:59 am
Location: Eastleigh,Nairobi

Re: PHP send_mail help needed

Post by phpserver »

Have you checked .htaccess files that came with the script?.As a security routine,yahoo creates .htaccess on demand.Talk with your web host,he will help you out.If he dont,get a swift mailer class and rewrite the send email functions to you liking.
php_chik
Forum Newbie
Posts: 3
Joined: Tue Dec 16, 2008 6:42 am

Re: PHP send_mail help needed

Post by php_chik »

TurboMatt wrote:edit: premature posting. I did not resolve the issue as I thought.

Anyway, I have a website hosted on Yahoo! and it appears that my PHP scripting is not supported on their end. Yahoo requires a 'from' section in the php script that is a e-mail address in your domain. I have a send_mail.php file that came with a template that I purchased. The developement company hosted it temporarily on their web server and it works perfect. When I upload the site to yahoo, the php contact page will not work.

Here is the send_mail.php script. Note - I changed my domain from the real domain to to mydomain.

<?php
$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];

if( $contact_name == true )
{
$sender = $contact_email;
$receiver = "help@Mydomain.net";
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Name: $contact_name \nEmail: $sender \nSubject: $contact_subject \nMessage: $contact_message \nIP: $client_ip \nMydomain Email System";
$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();

if( mail( $receiver, "Mydomain Support Form - $subject", $email_body, $extra ) )
{
echo "success=yes";
}
else
{
echo "success=no";
}
}
?>


What does it tell you when you try and send the mail?
Post Reply