Page 1 of 1

HELP PLEASE PHP ERROR WITH MAIL

Posted: Wed Feb 04, 2009 5:59 pm
by xpander54
Hello!! thanks for reading my message i got a php mail script but i cant make it work, my smtpout server requires authentication and i dont know how to put it on the script i got something like this and it doesnt work

<?php
/**
*
*
*/
// set this to your email address
$to = "rodrigo@holboxdesign.com";
$host = "smtpout.secureserver.net"
$username = "rodrigo@holboxdesign.com";
$password = "ev252omxo";
// shouldn't need to change anything past this line
$from = $_POST['formName'];
$email = $_POST['formEmail'];
$message = $_POST['formMessage'];
$headers = "From: " . $_POST['formName'] . " <" . $_POST['formEmail'] . ">\n";
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));


// set the message to whatever you'd like
$subject = "Message from MD Portfolio Site";

$body = "From: $from\n E-Mail: $email\n Message:\n\n $message";
$mail = $smtp->send($to, $subject, $body, $headers);

$sendStatus = "success";
echo $sendStatus;

?>

when i run this code php dont say nothing about mail or anything on the error log
but if i run this code

<?php
/**
*
*
*/
// set this to your email address
$to = "rodrigo@holboxdesign.com";

// shouldn't need to change anything past this line
$from = $_POST['formName'];
$email = $_POST['formEmail'];
$message = $_POST['formMessage'];
$headers = "From: " . $_POST['formName'] . " <" . $_POST['formEmail'] . ">\n";

// set the message to whatever you'd like
$subject = "Message from MD Portfolio Site";

$body = "From: $from\n E-Mail: $email\n Message:\n\n $message";
mail($to, $subject, $body, $headers);

$sendStatus = "success";
echo $sendStatus;

?>

Php error log says this

[04-Feb-2009 17:59:05] PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: SMTP server response: 553 Sorry, that domain isn't in my list of allowed rcpthosts. in C:\wamp\www\holbox\php\mail_script.php on line 19

pls help me PLSSSSSSS

:banghead: :dubious: :|

Re: HELP PLEASE PHP ERROR WITH MAIL

Posted: Wed Feb 04, 2009 8:50 pm
by Brad7928
I'm looking to do the same thing... the problem i am having though is that it won't send from php to my smtp server.

You could try PEAR Mail or Use a socket connection.. if this sounds like too much hard work.. then
get a copy of phpmailer (http://sourceforge.net/projects/phpmailer) and that will do it all for you including HTML email and attachments.

Also try having a look at this:

http://www.codewalkers.com/c/a/Email-Co ... il-Script/.

I've been told to to make sure socket support is on (look in your phpinfo under the heading sockets).

Mine is enabled, but still didn't work...

Let me know how you go!

Cheers,

Brad

Re: HELP PLEASE PHP ERROR WITH MAIL

Posted: Wed Feb 04, 2009 9:24 pm
by Benjamin
xpander54, Please use the appropriate

Code: Select all

 [ /code] tags when posting code blocks in the forums.  Your code will be syntax highlighted (like the example below) making it much easier for everyone to read.  You will most likely receive more answers too!

Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces.  You can even start right now by editing your existing post!

If you are new to the forums, please be sure to read:

[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]

If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online.  You'll find code samples, detailed documentation, comments and more.

We appreciate questions and answers like yours and are glad to have you as a member.  Thank you for contributing to phpDN!

Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]