I want to convert the link to the button in PHP mail.php file.
$message = sprintf($this->language->get('mail_message'), $store_name, $link);
I will appreciate if someone helps me to convert the link to the button.
To achieve this, you have to send html email instead of plain/text email. It is pretty simple, leave the images on the server and send the PHP + CSS to them...
$to = 'xyz#example.com';
$subject = 'Subject';
$headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "CC: abc#example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$message = '<p>Anchor Text</p>';
mail($to, $subject, $message, $headers);
Related
I have a website contact form that sends as an email to my iPhone. The problem is I am getting the following message:
"This message cannot be displayed because of the way it is formatted. Ask the sender to send it again using a different format or email program. multipart/mixed"
Is this has something to do with email content-type and how to fix it in my PHP code.
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From:".$from_email."\r\n";
$headers .= "From:".$from_email."\r\n";
$headers .= "Reply-To: ".$sender_email."" . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";
$body = "--$boundary\r\n";
$body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n\r\n";
$body .= chunk_split(base64_encode($message_body));
$sentMail = mail($recipient_email, $subject, $body, $headers);
You specify the Content-Type as a header string.
Assuming you are appending your headers with the standard dot notation, you would use:
$headers .= "Content-Type: multipart/mixed";
And later this would become the fourth parameter of your mail() function:
mail($address, $subject, $message, $headers);
Here's a basic example:
$address = 'sample#sample.com';
$subject = 'Subject';
$message = 'Message';
$headers = "From: My Name<something#something.com>\n";
$headers .= "Reply-To: something#something.com \n";
$headers .= "Content-Type: multipart/mixed";
mail($address, $subject, $message, $headers);
I want to send confirmation link to new users. I used this code to send mail (confirmation link)
$to = $email;
$subject = "Verify Your Account";
$actual_link = "http://myorchidkart.com/simplepay/verify_email.php?hash=" . $hash;
$message = "<a href ='".$actual_link."'>" . $actual_link . "</a>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: ". $from. "\r\n";
$headers .= "Reply-To: ". $from. "\r\n";
mail($to, $subject, $message, $headers);
but there is no confirmation link, only text but no link
how can I solve this ...?
mail is look like this
enter image description here
I would like to know how can I remove the auto line break in email. I am using the phpmailer function:
$from = 'dass#gmail.com';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: ".$from."\r\n";
$headers .= "Reply-To: admin#gmail.com \r\n";
$returnPath = "-r".$from;
mail($to, $subject, $msgbody, $headers, $returnPath)
Here is a running example:
jsfiddle.net/qwyh0551/
Replace this code:
<td>What ki
nd
By this code:
<td>What kind
And your problem is gone. The french fries link does work in the fiddle, so I assume you already fixed that.
$message = 'What are the other benefits to saying "nah" that you can think of? - ' . $_POST['other-benefits'] . '<br>' .
'What are you pledging to do? - ' . $_POST['what-pledge'] . '</p>';
I am trying to do a break after each line in php but with embedded HTML. When I send an email(function not included) it doesn't render with breaks. It literally just types out the as a string. Is there a way to correct this?
Given the lack of information given about the problem, I can only assume that the issue is that the headers of the email have not been set to send HTML emails.
You'll have to do something along the lines of:
// Setup email content.
$to = "example#email.com";
$subject = "Example HTML email";
$message = 'What are the other benefits to saying "nah" that you can think of? - ' . $_POST['other-benefits'] . '<br>' .
'What are you pledging to do? - ' . $_POST['what-pledge'] . '</p>';
// Setup headers.
$headers = "From: from#email.com\r\n";
$headers .= "Reply-To: replyto#email.com\r\n";
$headers .= "CC: susan#example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
// This next one is where the magic happens.
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// Send!
mail($to, $subject, $message, $headers);
Refer to: https://css-tricks.com/sending-nice-html-email-with-php/
In order to send an email containing html, pay special attention to the following headers:
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
Example Code:
$otherbenefits = $_POST['other-benefits'];
$whatpledge = $_POST['what-pledge'];
$email = <<< LOL
<html>
<body>
<p> What are the other benefits to saying "nah" that you can think of? - $otherbenefits <br> What are you pledging to do? - $whatpledge </p>
</body>
</html>
LOL;
$emailaddress = "personsemail#website.com";
$subject = "Test Email";
$headers = "From: noreply#server.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($emailaddress, $subject, $email, $headers);
For more information, please visit PHP.net regarding the mail() function and how to send email as HTML.
http://php.net/manual/en/function.mail.php
I'm making a form, when it submits it sends you a HTML email with a confirmation that you submitted it correctly.
When I receive the email; the content type header is inside the body of the email and the HTML code is displaying as raw text.
Screenshot:
Here is my code:
$to = 'myemail#gmail.com';
$subject = "HTML email";
$body = "<html><body><h1>Hello world!</h1></body></html>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <webmaster#website.com/>' . "\r\n";
mail($to, $subject, $body, $headers);
Could anyone please tell me what exactly is going wrong?
Thank you
Change your below three lines
From
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: <webmaster#website.com/>' . "\r\n";
To
$headers = "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type:text/html;charset=iso-8859-1" . PHP_EOL;
$headers .= 'From: <webmaster#website.com/>' . PHP_EOL;
I think after that this will work properly