Jump to content

Archived

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

myusualsnwastaken

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="tigeradvance2000@yahoo.com";
$body = "tagman has just sent you an email";
$header = 'From: tagadvance@gmail.com'

$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]

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.