- This topic is empty.
October 7, 2013 at 10:39 am #152226matt_sanfordParticipant
Quick question for you guys, I have a fairly simple contact form (php obviously) that sends off an email upon completion of the form. However in the interest of good UX and UI, I have made an html email template with my client’s logo and colors—all that jazz. So instead of using the mail() method, is there a command I can send to my server that says, “hey ‘fancy-custom-email.html’ go to this person’s inbox?” seeing past the humor, is there any documentation or just straight up advice you guys can lend me? Let me know if I am not being very clear. I will try my best to clear it up.
-MattOctober 8, 2013 at 2:28 pm #152386StathisGParticipant
I would suggest using something like PHPMailer instead of the build-in mail() function. It will save you from a lot of headaches. So, based on the example on its readme file, after replacing the configuration values with your own, you’ll pass the whole html email that you want to send, to the
For example, if your html template is the following:
<h1>This is my HTML email</h1> <p>I can use <strong>any tag</strong> I want</p>
You’ll end up with:
$mail->Body = '<h1>This is my HTML email</h1> <p>I can use <strong>any tag</strong> I want</p>';October 12, 2013 at 11:31 am #152236__Participant
$headers = "From: [email protected]\r\n" . "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=utf-8\r\n"; mail( $to,$subject,$body,$headers );
You should look into other email packages, though, especially if you need to do anything more complex (e.g., multiple or frequent emails; attachments, etc.).
(having trouble posting this. please accept my apologies this double-posts.)
- The forum ‘Back End’ is closed to new topics and replies.