February 26, 200917 yr I know, original title huh! I just found out about this forum yesterday and am quite thrilled about it. By far it looks like the best forum specifically for web designers, that I've seen so far. So, here's a question I have... I found a great little open source PHP code, which works very well; it is for Tell-a-Friend forms, and your visitor can tell 3 people about your site; not only can you customize the message the friends receive, but you can also set it so that you receive a message telling you your site was referred (and to who!). You can check out the script here: http://www.tamingthebeast.net/articles3/te...iend-script.htm My question: is there a way that I can format the e-mail the friends receive? I'd love to be able to add pictures, and perhaps format the text. This is probably very simple to do, but I'm still learning the little tricks of PHP - I'm much more familiar with HTML really. Thanks a lot! Regards, Maia web designer at www.tibbydesigns.com
February 26, 200917 yr Hi, First off, welcome to the forum and yes it is the best on the Internet. The text you need to change is between the quotes in the code below. $ttext = " Hi, A friend or colleague of yours, $_POST[name] , whose email address is $_POST[email] thought you may like to visit our site. $_POST[name] has used our Tell-a-Friend form to send you this email. http://www.yoursite.com ";
February 26, 200917 yr Author Hi, First off, welcome to thr forum and yes it is the best on the Internet. The text you need to change is between the quotes in the code below. $ttext = " Hi, A friend or colleague of yours, $_POST[name] , whose email address is $_POST[email] thought you may like to visit our site. $_POST[name] has used our Tell-a-Friend form to send you this email. http://www.yoursite.com "; Hey there, Thanks for the reply! Yes, I know which text to modify I'm just not quite sure how to format it in PHP, and how one can add pictures or change the font. Do you know if there are any tutorials on this? Regards, Maia web designer at www.tibbydesigns.com
February 26, 200917 yr Sorry, my mistake. Well, as far as I'm aware you can't format the text other than adding line breaks using carriage return. I'm no expert though so maybe one of the more experienced members will be able to help.
February 26, 200917 yr Author Sorry, my mistake. Well, as far as I'm aware you can't format the text other than adding line breaks using carriage return. I'm no expert though so maybe one of the more experienced members will be able to help. Okay, no problem. You may very well be right - as I said I don't know much about PHP so I might be trying to do something impossible. Regards, Maia web designer at www.tibbydesigns.com
February 26, 200917 yr Hi, and welcome to the forum again! Im not familiar with php....but... If they do not have HTML enabled in their email client, they will not be able to see any colours or images anyway. Or their email client might not support colours? I think you dont need to change the format. Just leave it as plain text. But if you wanted to change the format, i think you can just add $ttext = " <html> <body> <span style="color:#cc0000;"> Hi, A friend or colleague of yours, $_POST[name] , whose email address is $_POST[email] thought you may like to visit our site. $_POST[name] has used our Tell-a-Friend form to send you this email. http://www.yoursite.com </span> </body> </html> "; If <span style=""> doesnt work, try the proper old school way: <font color="red"></font> Not 100% sure if it will work, but give it a try, im curious now!
February 26, 200917 yr The above should work, but you need to either escape the quotes, or use single quotes. Otherwise the first " in your html, will be interpreted as the ending quote for $ttext = " i.e it would interpret this as the full bit of code $ttext = " <html> <body> <span style=" Because it has the starting quote and the ending quote. Anyway, do either of these... Escaped: $ttext = " <html> <body> <span style=\"color:#cc0000;\"> Single quotes: $ttext = ' <html> <body> <span style="color:#cc0000;"> Hi, A friend or colleague of yours, $_POST[name] , whose email address is $_POST[email] thought you may like to visit our site. $_POST[name] has used our Tell-a-Friend form to send you this email. http://www.yoursite.com </span> </body> </html> ';
February 26, 200917 yr Author Just tried those out but unfortunately neither worked. Oh well, guess I'll have to deal with it. It's not that bad really, I was just hoping to make those e-mail pop with colors.
February 26, 200917 yr To send a html email, you need to set the Content-type as text/html. Have a look at the PHP Manual for an example, (example 4). Also have a read of all of the comments. It appears to be a pain in the arse to get right. Good luck
Create an account or sign in to comment