PHP to send registered mail, Mail received after the change to plain HTML text

Source: Internet
Author: User
The code is as follows:

}
Else
{
if (Isset ($_post[' N_register '))
{
$mail = Trim ($db->escapestring ($_post[' reg_mail '));
$mail _re = Trim ($db->escapestring ($_post[' reg_mail_re '));

if (!preg_match ("/^[a-za-z_\\-][\\w\\.\\-_]*[a-za-z0-9_\\-]@[a-za-z0-9][\\w\\.-]*[a-za-z0-9]\\.[ A-za-z][a-za-z\\.] *[a-za-z]$/i ", $mail))
{
$ERRORMSG = $langBase->get (' home-08 ');
}
ElseIf ($mail!== $mail _re)
{
$ERRORMSG = $langBase->get (' home-09 ');
}
ElseIf ($db->getnumrows ($db->query ("SELECT ID from ' [Users] ' WHERE ' email ' = '". $mail. " LIMIT 1 ")) > 0)
{
$ERRORMSG = $langBase->get (' home-10 ');
}
ElseIf ($db->getnumrows ($db->query ("SELECT ID from ' [Users] ' WHERE ' ip_regged_with ' = '". $_server[' REMOTE_ADDR ') ."' LIMIT 1 ")) > 0)
{
$ERRORMSG = $langBase->get (' home-11 ');
}
ElseIf ($db->getnumrows ($db->query ("Select ID from ' temporary ' WHERE ' playerid ' = '". $mail. " and ' active ' = ' 1 ' and ' area ' = ' register ' and ' time_added ' + ' expires ' > '. Time (). "' LIMIT 1 ")) > 0)
{
$ERRORMSG = $langBase->get (' home-111 ');
}
ElseIf (!isset ($_post[' Acc_tos '))
{
$ERRORMSG = $langBase->get (' home-12 ');
}
Else
{
$extra = Array (
' Mail ' = $mail,
' Enlist ' = isset ($_get[' e ')? $db->escapestring ($_get[' e ']): $ref _id
);
$enlist _id = isset ($_get[' e '])? $db->escapestring ($_get[' e ']): $ref _id;

$tempID = substr (SHA1 (Uniqid (rand ())), 0, 6);
$db->query ("INSERT into ' temporary ' (' id ', ' playerid ', ' area ', ' Expires ', ' time_added ', ' Extra ') VALUES ('". $tempID. " , ' ". $mail." ', ' register ', ' 3600 ', ' ". Time ()." ', ' ". Serialize ($extra)." ') ";

Mail ($mail, $admin _config[' game_name ' [' Value ']. Signup ',
'











'. $admin _config[' game_name ' [' Value ']. '

«signup


Hello,




Click bellow to go at step 2:

'. $config [' Base_url ']. '? Side=signup&step=2&v= '. $tempID. '


This link is active until '. View::time (Time () +3600, true).

Best regards,


'. $admin _config[' game_name ' [' Value ']. '


',
"Reply-to:". $admin _config[' game_name ' [' Value ']. "<". $admin _config[' contact_email ' [' Value ']. " >\r\n ".
"From:". $admin _config[' game_name ' [' Value ']. "<". $admin _config[' contact_email ' [' Value ']. " >\r\n ".
"Mime-version:1.0\r\n".
"Content-type:text/html; Charset=iso-8859-1 ");

$SUCCESSMSG = $langBase->get (' home-24 ');
}
}
?>


Reply to discussion (solution)

Print HTML text separately to see if it can be parsed.

The mailbox does not support HTML??

The mailbox does not support HTML??


Qq/hotmail/126 have tried, and received all the pure HTML

I'll give you an e-mail function.

function Send_mail ($to, $subject = ' No subject ', $body) {
$loc _host = "Mail.server"; The name of the sending computer, can be arbitrarily
$SMTP _ACC = "test@163.com"; e-mail Email
$SMTP _pass= "111"; Password
$SMTP _host= "ssl.corp-email.com"; Mail server
$from = "test@163.com"; e-mail Email
$deliver = $smtp _acc;
$headers = "Content-type:text/plain; Charset=\ "gb2312\" \r\ncontent-transfer-encoding:base64 ";
$lb = "\ r \ n";
$HDR = Explode ($lb, $headers);
if ($body) {$bdy = Preg_replace ("/^\./", ".", Explode ($lb, $body));}

$SMTP = Array (

Array ("EHLO". $loc _host. $lb, "220,250", "HELO Error:"),

Array ("AUTH LOGIN". $lb, "334", "AUTH Error:"),

Array (Base64_encode ($smtp _acc). $lb, "334", "Authentification Error:"),

Array (Base64_encode ($smtp _pass). $lb, "235", "Authentification Error:"));

$SMTP [] = Array ("MAIL from: <" $from. " > ". $lb," "," "MAIL from Error:");

$SMTP [] = Array ("RCPT to: <" $to. " > ". $lb," "," RCPT to Error: ");

$SMTP [] = Array ("Data". $LB, "354", "Data error:");

$SMTP [] = Array ("From:". $deliver. $lb, "", "");

$SMTP [] = Array ("To:". $to. $lb, "", "");

$SMTP [] = Array ("Subject:". $subject. $lb, "", "");

foreach ($hdr as $h) {$SMTP [] = Array ($h. $lb, "", "");}

$SMTP [] = Array ($lb, "", "");

if ($bdy) {foreach ($bdy as $b) {$SMTP [] = Array (Base64_encode ($b. $lb). $lb, "", "");}}

$SMTP [] = Array (".". $LB, "+", "DATA (end) Error:");

$SMTP [] = Array ("Quit". $lb, "221", "Quit Error:");


$fp = @fsockopen ($smtp _host, 25);
if (! $fp) echo "Error:Cannot conect to ". $smtp _host."
";
while ($result = @fgets ($fp, 1024x768)) {if (substr ($result, 3,1) = = "") {Break;}}

$result _str= "";

foreach ($smtp as $req) {

@fputs ($fp, $req [0]);

if ($req [1]) {

while ($result = @fgets ($fp, 1024)) {
if (substr ($result, 3,1) = = "") {break;}
};
if (!strstr ($req [1],substr ($result, 0, 3))) {
$result _str.= $req [2]. $result. "
";
}
}
}

@fclose ($FP);
return $result _str;
};

?>

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.