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="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]
Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.