my problem is that when you register a user is generated random code that is sent to the email I made a template for emails that contains basic text together with styles this email only changes the basic link with the generated code.So everything should work as I meant but currently during registration comes email but without the styles that I gave. Codes below.
$to = $email;
$subject = "Registration Confirmation";
$link = "<a href='".DIR."/activation?x=$latest_id&y=$activasion'>".DIR."/activation?x=$latest_id&y=$activasion</a>";
$headers = "MIME-Version: 1.0" . "\r";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: '.$from."\r\n".
'Reply-To: '.$from."\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = file_get_contents("inc/user_register.html");
$message = str_replace('[link]', $link, $message);
mail($to, $subject, $message, $headers);
header("location: /login?action=joined");
You are missing \n at the first headers[]. You can also try this way for setting the header.
// To send HTML mail, the Content-type header must be set
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
// Additional headers
$headers[] = 'To: Mary <mary@example.com>, Kelly <kelly@example.com>';
$headers[] = 'From: Birthday Reminder <birthday@example.com>';
$headers[] = 'Cc: birthdayarchive@example.com';
$headers[] = 'Bcc: birthdaycheck@example.com';
// Mail it
mail($to, $subject, $message, implode("\r\n", $headers));
PROBLEM SOLVED
I were using import font from google font website. I have deleted it from the styles and working like I wanted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.