Jump to content


Photo

Invalid E-mail Address


  • Please log in to reply
4 replies to this topic

#1 myusualsnwastaken

myusualsnwastaken
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 July 2006 - 05:35 AM

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
<?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";
}
?>
And a link to actualfile/phpinfo:
tagman.phpnet.us/mail.php
tagman.phpnet.us/phpinfo.php
It outputs:
bool(true) There was a problem sending the mail. Check your code and make sure that the e-mail address tagadvanceatgmaildotcom is valid


#2 bpops

bpops
  • Members
  • PipPipPip
  • Advanced Member
  • 232 posts

Posted 28 July 2006 - 05:38 AM

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?

#3 myusualsnwastaken

myusualsnwastaken
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 July 2006 - 07:45 PM

Its not my server. =(

#4 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 07:59 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#5 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 28 July 2006 - 08:30 PM

No, the mail() function takes up to 5 parameters:
  • 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)
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/m...nction.mail.php

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users