0

PHP help needed

I am a woodworker married to a painter - although i can build a basic web site and maybe a Flash page this is Way outa my league!
For Lois' web site we purchased the rights to an XML template. It works well except for the "contact page"
www.studiopaintings.com

I contacted the person who we bought the site from at flashcomponents.net ant they said it was a PHP problem with our webhost, and they could not help.

I cannot figure out where to start, Or if this is even the right forum to ask in??

The send_message.php file they provided is below.
I did enter a valid email address from our Yahoo hosted website so I stopped getting the following message in my .tmp file
2009 Sep 25 04:30:19 Result: 9
2009 Sep 25 04:30:19 From address not in member domain. Message not sent.

BUT now the message just seems to go nowhere. No error return, nor any sent...
Any help would be greatly appreciated. If someone needs some beer money to help with this I can certainly send it.
I can be contacted at bob at schlowsky . com
Thank you
Bob

send_message.php

<?php
$name_txt = $_POST['nume_txt'];
$tel_txt = $_POST['phone'];
$email_txt = $_POST['email_txt'];
$msg_txt = $_POST['mesaj_txt'];

$contact_form_title = "DEMO CONTACT FORM";
$contact_form_subject = "CONTACT FORM SUBJECT";
$email_to_send = "loisromeischlowsky@schlowsky.com";

$message = "Name:".$name_txt."\nPhone:".$tel_txt."\nEmail:".$email_txt."\nMessage:".$msg_txt;
_send_mail($email_to_send, $contact_form_title, $contact_form_subject, $message);

function _send_mail($mailto, $contact_form_title, $subject, $message) {
$header = 'From: '. loisromeischlowsky@schlowsky.com . "\r\n" .
'Reply-To: loisromeischlowsky@schlowsky.com' . "\r\n" .
'X-Mailer: PHP/';
if (mail($mailto, $subject, $message, $header)) {
echo 'sent=OK&dum=nimic';
} else {
echo 'sent=ER&dum=nimic';
}
}
?>

by
3 Replies
  • Hi Bob,

    It looks like the issue might indeed be with your server configuration. What is probably happening is that your mail server is refusing to relay e-mails from an e-mail address that does not exist on your server.

    Try changing your _send_mail function to the following and see if this works. I'm stripping out the header information which should allow the server to use the default send mail address:

    CODE
    function _send_mail($mailto, $contact_form_title, $subject, $message) {  
    if (mail($mailto, $subject, $message)) {
    echo 'sent=OK&dum=nimic';
    } else {
    echo 'sent=ER&dum=nimic';
    }
    }


    Let me know if that helps.

    Jonathan LeBlanc
    Technology Evangelist
    Yahoo! Developer Network
    Twitter: jcleblanc
    0
  • Jonathan;
    Thank you for the help.
    I stumbled onto the following after reading a lot of 1/2 understood examples and many trial and error attempts

    <?php
    $to = "lois@_our_domain.com";
    $name = $_POST['nume_txt'];
    $email_txt = $_POST['email_txt'];
    $msg_txt = $_POST['mesaj_txt'];
    $subject = "Studio Paintings email from : " .$name;
    $message = "the senders name:".$name."\ntheir email address:".$email_txt."\ntheir Message:".$msg_txt
    $headers = "From: lois@_our_domain.com";
    mail($to,$subject,$message,$headers);
    'X-Mailer: PHP/';
    echo 'sent=OK&dum=nimic';
    ?>

    It actually works well, but it doesn't really check to see if the mail sent. I will use your code to correct that part when I get time this week.
    Again thank you for your help
    Bob
    0
  • For mail function to work properly please check the links below from Yahoo! Web hosting help.

    Which PHP functions does Yahoo! support?
    http://help.yahoo.com/l/us/yahoo/smallbusi...php/php-33.html
    Mail functions (Note: To use mail with PHP, you'll need to complete PHP/Perl Mail Setup.)

    How can I send email with PHP?
    http://help.yahoo.com/l/us/yahoo/smallbusi...php/php-17.html
    Before you can send email with PHP, you must complete the PHP Mail Setup process.

    If you haven't completed the PHP Mail Setup process then this could be the cause of the problem.

    Hope it helps!
    0

Recent Posts

in PHP Development