Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3
Formatted E-Mail
DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 21, 2019, 10:19:18 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: Formatted E-Mail  (Read 6873 times)
0 Members and 1 Guest are viewing this topic.
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« on: July 18, 2014, 09:22:18 AM »

Just something I decided to add to my own site, and wanted to share with others.

When one requests an email from an LoGD (for a character validation, forgotten password, admins for new petitions, etc), the emails look plain and boring. Attached is a spiced-up version.

Instructions on use:

  • Upload all files to core, keeping folder structure.
  • Replace "yourwebsite.com" and "Your Website" with your own site in lib/email.htm.
  • Include lib/html_mail.php in common.php.
  • Go through and changed every mail() function to html_mail().
  • Parameters don't need to be changed, just the name of the function.
  • Base areas for modification are create.php, lib/errorhandler.php, lib/expire_chars.php, lib/petition/petition_default.php and lib/systemmail.php.

CORE EDITS ARE DANGEROUS IF YOU DON'T KNOW WHAT YOU'RE DOING.

Use and modify it to your desires. Enjoy.
« Last Edit: April 07, 2017, 07:26:33 PM by Aeolus » Logged

BlackScorp
Militia
**
Offline Offline

Posts: 25


View Profile
« Reply #1 on: July 18, 2014, 01:35:25 PM »

well you have to send a multipart body

http://kevinjmcmahon.net/articles/22/html-and-plain-text-multipart-email-/

some clients like outlook are maybe configure to display text mails only, so if they get the mail, the will see nothing. if you send text and html body together, the clients will switch them
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« Reply #2 on: July 18, 2014, 06:14:33 PM »

well you have to send a multipart body

http://kevinjmcmahon.net/articles/22/html-and-plain-text-multipart-email-/

some clients like outlook are maybe configure to display text mails only, so if they get the mail, the will see nothing. if you send text and html body together, the clients will switch them

I've had no problems with HTML being displayed so far. If you wish to see where I got the code for such a layout, you can see here. You'll also see that the creator of the linked tutorial also gave screenshots of the email in different email clients - not a problem to be seen.

The screenshot I gave was from Outlook, and I've had plenty of emails from other companies and websites that use the HTML given. Your issue sounds like a bit of a 1990's issue. Tongue
« Last Edit: July 18, 2014, 06:29:37 PM by The Doctor » Logged

Sunday
Codemeister
****
Offline Offline

Posts: 406


So meme'd up.


View Profile
« Reply #3 on: July 20, 2014, 07:57:04 AM »

Oh look, an edit to the core that I actually like. No sarcasm here, for the first time in ages. Not too shabby. Though, for those new to core modifying, you may want to place a large banner that states core modification is dangerous, and can potentially break vital functions (Especially lib/systemmail.php). Perhaps even a modified version of the files, based on the core release, with commented sections of where you changed. Just so you do not have people complaining about 'you'  Roll Eyes breaking their game.
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5

A new server in the making...
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« Reply #4 on: July 20, 2014, 08:29:16 AM »

Oh look, an edit to the core that I actually like. No sarcasm here, for the first time in ages. Not too shabby. Though, for those new to core modifying, you may want to place a large banner that states core modification is dangerous, and can potentially break vital functions (Especially lib/systemmail.php). Perhaps even a modified version of the files, based on the core release, with commented sections of where you changed. Just so you do not have people complaining about 'you'  Roll Eyes breaking their game.

Thanks. Wink Added the banner. Even simplified the instructions so that lib/systemmail.php doesn't require edits (except for the last point).
Logged

Anharat
Codemeister
****
Offline Offline

Posts: 283



View Profile
« Reply #5 on: July 20, 2014, 12:58:52 PM »

If you are editing the core anyway why don't you actually just change the mail() function? Then you'd have to edit only that one file and not every call of the function.
You could just add the html_mail() in the start of the mail() function and add an empty return or something like that, so you keep the actual function but no further edits required.
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« Reply #6 on: July 20, 2014, 09:10:34 PM »

If you are editing the core anyway why don't you actually just change the mail() function? Then you'd have to edit only that one file and not every call of the function.
You could just add the html_mail() in the start of the mail() function and add an empty return or something like that, so you keep the actual function but no further edits required.

The mail() function is a PHP-provided function. If you are aware on how to override an existing function, do let me know!
Logged

Anharat
Codemeister
****
Offline Offline

Posts: 283



View Profile
« Reply #7 on: July 20, 2014, 11:55:40 PM »

Now that you mention it.. xD never mind then.  Smiley
Logged
BlackScorp
Militia
**
Offline Offline

Posts: 25


View Profile
« Reply #8 on: July 21, 2014, 12:10:28 AM »

The screenshot I gave was from Outlook, and I've had plenty of emails from other companies and websites that use the HTML given. Your issue sounds like a bit of a 1990's issue. Tongue

well i just know this issue from my dayly job, there are much more clients than outlook or thunderbird, also webbased clients. Some of them do not display anything, others are displaying the HTML Code as text and some others strip the tags and display the text(so links are removed sometimes as well)

it is not an issue of 1990. But yeah maybe none of the logd users will have any issue with it(cause there are not that much)
Logged
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 227


View Profile WWW
« Reply #9 on: July 21, 2014, 04:05:29 AM »

There is this nice "phpmailer" thingy you can also use. I put that in the core engine. Really easy and works like a charm.
Logged
BlackScorp
Militia
**
Offline Offline

Posts: 25


View Profile
« Reply #10 on: July 21, 2014, 04:24:33 AM »

There is this nice "phpmailer" thingy you can also use. I put that in the core engine. Really easy and works like a charm.

indeed phpmailer or swiftmailer would be better solution
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« Reply #11 on: July 21, 2014, 05:33:51 AM »

well i just know this issue from my dayly job, there are much more clients than outlook or thunderbird, also webbased clients. Some of them do not display anything, others are displaying the HTML Code as text and some others strip the tags and display the text(so links are removed sometimes as well)

it is not an issue of 1990. But yeah maybe none of the logd users will have any issue with it(cause there are not that much)

As I mentioned before, the creator of the tutorial I used tested it in many clients, and it worked. If you want to test them, go right on ahead. I can also name four LoGDs with over one or two thousand users, so there's a good many players.

And as I said at the start:

Use and modify it to your desires.

I'm not releasing this as a module to constantly update. I'm only releasing what I've done for my own site, in case other admins are interested by the idea of it. If you want to make it better, by all means, go ahead. If you want to release your better versions on this thread, by all means, go ahead.
« Last Edit: July 21, 2014, 05:52:59 AM by The Doctor » Logged

GRRRilla Ninja
Codemeister
****
Offline Offline

Posts: 321


View Profile
« Reply #12 on: December 13, 2014, 04:53:39 PM »

Trying to integrate this and completed all steps listed above, but a search for mail() only returns results from my phpBB forum directory? Where are the mail() functions I am supposed to replace with html_mail() ? Also, can I apply this template to every email sent by the game?
« Last Edit: December 13, 2014, 04:56:33 PM by GRRRilla Ninja » Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1934


You're welcome.


View Profile WWW
« Reply #13 on: December 13, 2014, 05:34:07 PM »

Here's a start:

Base areas for modification are create.php, lib/errorhandler.php, lib/expire_chars.php, lib/petition/petition_default.php and lib/systemmail.php.

A good module to use for searching for all of the mail() function calls is Code String Search. And once you've changed all mail()'s to html_mail()'s, then yes, the template will be applied to all emails sent by the game.
Logged

GRRRilla Ninja
Codemeister
****
Offline Offline

Posts: 321


View Profile
« Reply #14 on: December 13, 2014, 08:06:28 PM »

still no results
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
76 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search