View previous topic :: View next topic |
Author |
Message |
Ne0nx3r0
Joined: 29 Nov 2006 Posts: 36
|
Posted: Wed Nov 29, 2006 20:10 Post subject: NWMail |
|
|
I've been tinkering around with a new module that could use a function to send emails out, and I was wondering - what's the best way to accomplish this?
I have a server 2003 (legally licensed ) machine that can run SMTP, so a standard text file output would work alright, but I also thought it might be better to have the emails saved to a mysql table, then have some external application grab them and send them out periodically.
I guess it really boils down to just outputting a few strings (and creating the appropriate new lines) into a text file who's name would need to be (slightly) unique that would be located in my C:\inetpub\mailroot\pickup folder... or of course the mysql option I mentioned above, which could use the exsiting database plugins, and some external app to periodically query the DB.
Would it just be best to write a custom plugin for nwnx to do this, or is there something already started I could possibly mutate into what I'm looking for?
I'm a fairly experienced coder, so anything, even a place to start reading would be helpful to me.
Thank you for your time ,
Ne0nx3r0 |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Thu Nov 30, 2006 10:20 Post subject: |
|
|
I think a new plugin would be the way to go.
Might I add one suggestion ? SMTP is an easy protocol, and I am sure there are C++ libraries that handle the more complicated stuff like authentication. You could create a plugin that directly talks to the SMTP server, like a normal mail client would. _________________ Papillon |
|
Back to top |
|
|
Grinning Fool
Joined: 12 Feb 2005 Posts: 264
|
Posted: Thu Nov 30, 2006 18:01 Post subject: |
|
|
Just remember that you'd need to have a separate thread for actually communicating with the SMTP server. Otherwise, if the SMTP server stopped responding, the NWN server would get hung. _________________ Khalidine, a NWN2 persistent world
Looking for volunteers. |
|
Back to top |
|
|
Ne0nx3r0
Joined: 29 Nov 2006 Posts: 36
|
Posted: Fri Dec 01, 2006 6:19 Post subject: |
|
|
That's true, but I thought it would just be simpler to use the built-in SMTP functionality server 2003 has, since all it requires it outputting a text file - that way it not only is simpler to write, but wont cause the actual server processes any issues if something goes wrong - you just have a bunch of text files that'll get sent out when the SMTP service gets on it's feet. Plus it just saves a mess of time on dealing with error handling and all that.
Thank you for your ideas though |
|
Back to top |
|
|
Khamul85
Joined: 04 Dec 2006 Posts: 3
|
Posted: Mon Dec 04, 2006 1:55 Post subject: |
|
|
If it is to for example to use it on your own PW/RP server then I belive the simplest way would be to use NWNX and mysql database.. Save whatever mails you want emailed in a mysql table from game. Then make a php script or something that runs a interval that checks the table for content, if so then it gets sendt as a email and delete it from the database..
Use this function in PHP to send mail: http://no.php.net/manual/en/function.mail.php |
|
Back to top |
|
|
Ne0nx3r0
Joined: 29 Nov 2006 Posts: 36
|
Posted: Mon Dec 18, 2006 16:22 Post subject: |
|
|
I'm thinking that might be a decent option... either PHP or ActivePerl, since it's a window server. I think you're right though, that is the simplest option, since it doesn't require very much coding or extra addons. I'm tempted to write a plugin to export text to a specified file anyway, if for nothing else than just for stacks and giggles. |
|
Back to top |
|
|
|