logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
NWMail

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Ne0nx3r0



Joined: 29 Nov 2006
Posts: 36

PostPosted: Wed Nov 29, 2006 20:10    Post subject: NWMail Reply with quote

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 Razz) 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 Smile,
Ne0nx3r0
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Thu Nov 30, 2006 10:20    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Thu Nov 30, 2006 18:01    Post subject: Reply with quote

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
View user's profile Send private message
Ne0nx3r0



Joined: 29 Nov 2006
Posts: 36

PostPosted: Fri Dec 01, 2006 6:19    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Khamul85



Joined: 04 Dec 2006
Posts: 3

PostPosted: Mon Dec 04, 2006 1:55    Post subject: Reply with quote

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
View user's profile Send private message
Ne0nx3r0



Joined: 29 Nov 2006
Posts: 36

PostPosted: Mon Dec 18, 2006 16:22    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group