Jump to content

Invalid E-mail Address


Recommended Posts

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

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

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.php

Ken
Link to comment
https://forums.phpfreaks.com/topic/15858-invalid-e-mail-address/#findComment-65419
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.