Page 2 of 2

Posted: Mon Nov 06, 2006 3:25 pm
by RobertGonzalez
Just as an aside, any time your variables print out as the variable and not the value of the variable, it is almost 100% string type and quote issues. You might want to read up on PHP Strings.

Code: Select all

<?php
$hello = 'HELLO';

// Prints $hello world
echo '$hello world';

// Prints HELLO world
echo "$hello world";

// As does this
echo $hello . ' world';
?>

Posted: Mon Nov 06, 2006 3:49 pm
by mikewooten
ok that works, but the only thing now is that the auto respond does not work, this is what i have added, what do i need to add or change to get this to work?

Code: Select all


 $user_email2 = $_POST["user_email2"]; 
$message = $_POST["message"]; 
$auth_name2 = "Mike Wooten"; 
  
$to      = 'mikewooten@wootenmedia.com'; 
$subject = 'subject here'; 
$headers = "From: $user_email2" . "\r\n" . 
   'Reply-To: mikewooten@wootenmedia.com' . "\r\n" . 
   'X-Mailer: PHP/' . phpversion(); 

echo "<pre>mail($to, $subject, $message, $headers);</pre>"; 
mail($to, $subject, $message, $headers); 

$headers2 = "MIME-Version: 1.0\r\n Content-Type: text/plain Charset=iso-8859-1\r\n From: $to";

$autorespond = mail("$user_email2", "Thanks For Your Email Inquiry", "Your email was sent successfully to $auth_name2. We will respond as soon as possible.",$headers2); 

echo '<font face="Arial">Your Email has been sent!</font>';


Posted: Mon Nov 06, 2006 4:01 pm
by RobertGonzalez
Mail returns a boolean. Try not setting $autoresponse equal, but instead just call it directly. I am not sure that will help, but it is worth a shot.

Posted: Mon Nov 06, 2006 4:10 pm
by mikewooten
how would i call it directly?
like this??

Code: Select all


$autorespond("$user_email2", "Thanks For Your Email Inquiry", "Your email was sent successfully to $auth_name2. We will respond as soon as possible.",$headers2); 


Posted: Mon Nov 06, 2006 4:18 pm
by RobertGonzalez

Code: Select all

<?php
$user_email2 = $_POST["user_email2"];
$message = $_POST["message"];
$auth_name2 = "Mike Wooten";
 
$to = 'mikewooten@wootenmedia.com';
$subject = 'subject here';
$headers = "From: $user_email2" . "\r\n" .
   'Reply-To: mikewooten@wootenmedia.com' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

// Mail the actual message
mail($to, $subject, $message, $headers);

// Handle autoresponse
$headers2 = "MIME-Version: 1.0\r\n Content-Type: text/plain Charset=iso-8859-1\r\n From: $to";
if ( mail($user_email2, "Thanks For Your Email Inquiry", "Your email was sent successfully to $auth_name2. We will respond as soon as possible.", $headers2) )
{
    echo '<font face="Arial">Your Email has been sent!</font>';
}
else
{
    echo '<font face="Arial">SORRY IT DID NOT WORK</font>';
}
?>
This is just a brief generic way of doing it.

Posted: Mon Nov 06, 2006 4:43 pm
by mikewooten
ok this works when i use my server addresses from wootenmedia, but when i type in an address from yahoo, i don't get an autoresponse from yahoo, aol etc.. is there anything that i can do to bypass that?

also, when i get the autoresponse, the "From" field shows up as nobody instead of the users email address. how can i get the "from" field to show the users email address?

Posted: Mon Nov 06, 2006 4:53 pm
by RobertGonzalez
Yahoo, aol, hotmail, etc might have spam filters that prevent messages like this. As for changing the name, look at the header details and see if it can be worked on there. Otherwise, it may be a server thing that only your host can fix.

Posted: Mon Nov 06, 2006 5:08 pm
by mikewooten
it might not be able to be worked on, i don't know, unless something can be changed in the script for this to work, but i have asked the hosting server if "Nobody" could be disabled, and they came back saying:
As for some security reasons we do not disable the option server wide. Disabling the option will increase the spam mails. So we don't disable the option.
if it is something with the header details, what could be changed in the header?

also, is there any other way to get around yahoo, aol spam filers?

Posted: Mon Nov 06, 2006 5:36 pm
by RobertGonzalez
This is about the best thing I've seen for sending emails that actually get to where they need to get to.
Everah wrote:It might not make a difference, but have you looked into using a package, like Swiftmailer?