myusualsnwastaken Posted July 28, 2006 Share Posted July 28, 2006 Is it possible for a server to block outgoing mail from the mailer function? This code doesnt do anything (but it prints unsuccessful), and ive tried it on two different servers. Thx[code=php:0]<?PHP$subject="Mail TEST";$to="[email protected]";$body = "tagman has just sent you an email";$header = 'From: [email protected]'$mailer = mail($to, $subject, $body, $header);if(!$mailer){echo "There was a problem sending the mail. Check your code.";}else {echo "Email Sent";}$mailer = var_dump(mail($to, $subject, $body, $header));if(!$mailer){echo "There was a problem sending the mail. Check your code.";}else {echo "Email Sent";}?>[/code]And a link to actualfile/phpinfo:[url=http://tagman.phpnet.us/mail.php]tagman.phpnet.us/mail.php[/url][url=http://tagman.phpnet.us/phpinfo.php]tagman.phpnet.us/phpinfo.php[/url]It outputs:[code]bool(true) There was a problem sending the mail. Check your code and make sure that the e-mail address tagadvanceatgmaildotcom is valid[/code] Link to comment https://forums.phpfreaks.com/topic/15858-invalid-e-mail-address/ Share on other sites More sharing options...
bpops Posted July 28, 2006 Share Posted July 28, 2006 I've no solution (never done mailing through php), but perhaps it might be a port setting or something else in php.ini?Have you tried checking that? Link to comment https://forums.phpfreaks.com/topic/15858-invalid-e-mail-address/#findComment-65000 Share on other sites More sharing options...
myusualsnwastaken Posted July 28, 2006 Author Share Posted July 28, 2006 Its not my server. =( Link to comment https://forums.phpfreaks.com/topic/15858-invalid-e-mail-address/#findComment-65388 Share on other sites More sharing options...
Ninjakreborn Posted July 28, 2006 Share Posted July 28, 2006 mailer = var_dump(mail($to, $subject, $body));By my knowledge replace body with $message, and the name of the variable to $message, it can't be sent with anything but either $message or "" with something in it, that is what I gathered, that is all I ever used. Link to comment https://forums.phpfreaks.com/topic/15858-invalid-e-mail-address/#findComment-65397 Share on other sites More sharing options...
kenrbnsn Posted July 28, 2006 Share Posted July 28, 2006 No, the mail() function takes up to 5 parameters:[list][*]Where the email is going -- the "To:" header[*]The subject of the email[*]The body of the message[*]Extra headers (optional, but should be required to be at least a From: header)[*]Extra Parameters (options -- only works with sendmail and sendmail clones)[/list]These pameters can either be literal strings or in variables (with any name). The most likely cause of your problem is that you're not including the 4th parameter with at least at "From:" header.Please read and understand the manual page for the mail() function http://us2.php.net/manual/en/function.mail.phpKen Link to comment https://forums.phpfreaks.com/topic/15858-invalid-e-mail-address/#findComment-65419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.