PHP mail problems.
Posted: Tue Aug 21, 2007 2:18 am
twigletmac | Please use
after execution of the code, it gives error "fail to send email...".
however, only one function works which is feedback function, the code as below:
It really makes me confused how it happens? Is there any expert can advise some suggestion? [s]Pls[/s] Please help... thank you
twigletmac | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
dear friends:
Recently i moved my application from linux enviroment to windows2003 enviroment. everything is ok but mail function.
after i setup mail server in windows, i tested it by sending a email to support@mydomain.com and i can receive it. and I also login to my domain email and send email via support@mydomain.com also ok.
--------------
but the problems: all the system email related fnction not (which they works in linux enviroment).
the code for tell frined function like below:Code: Select all
$headers .= "From: {$in['YouEmail']}\r\n";
$headers .= "To: {$in['Email']}\r\n";
$title .= "Your friend {$in['UserName']} sent your this link";
if(@mail($in['Email'], $title , $tmp . $in['Content'], $headers))
{
$Info = new Info('Email was sent successfully! Your friend will receive your email soon!.',
_PHP_SELF . '?act=login', $tpl);
$tpl->set_currentfile('main');
$tpl->set_var('DATA', $Info->Show());
}
else
{
new Error('Fail to send email, please contact admin to check email server configration.',
'', _CurrentURL, $tpl);
}however, only one function works which is feedback function, the code as below:
Code: Select all
$tpl->set_var('Title', $in['Title']);
$tpl->set_var('Sender', $in['Sender']);
$tpl->set_var('Email', $in['Email']);
$tpl->set_var('Content', $in['Content']);
$tpl->set_var('SenderIP', ip2long($in['REMOTE_ADDR']));
$str = $tpl->parse('mail');
$headers .= "From: domain.com <support@domain.com>\r\n";
$headers .= "To: domain.com <support@domain.com>\r\n";
@mail("support@domain.com", SYS_NAME . $title, $str, $headers);
}twigletmac | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]