Jump to content
Yoh Asakura

Send automatic emails

Recommended Posts

Hi,

 

I was talking to @@Dastgir and I've asked if it's possible to send an automatic email to those players that didin't log in the server for more than 20 days. The automatic message would be sent to the email that the player has registered. Many servers nowadays has this, but I still don't know how to do it.

 

I also would like to know how to send emails, like adverts to the player's email. I saw many servers that does it, and it's really good.

 

 

Kind Regards.

Share this post


Link to post
Share on other sites

Like I said :P,

They use SQL and php, they save emails on different table, so it doesn't interfere with server using SQL.

Then php performs query and selects all email and dates from table , uses simple if condition to check time logged in, then send email accordingly.

 

 

If someone could provide script, that would be good.(currently too busy to code one)

Share this post


Link to post
Share on other sites

by the way be warned that doing it might make all e-mails going into spam/trash folder, the best way of contacting players thru mail is using a subscription system in your website where the player will be able to choose whether they want or not to receive e-mails

Share this post


Link to post
Share on other sites

It is very easy with Python.

 

1. Create an email account

2. Select a SMTP server (Microsoft or Google)

3. Create MySQL user account with select privileges on last login column in login table.

4. Connect to MySQL server using limited privilege MySQL user account with SqlAlchemy (http://www.sqlalchemy.org)

5. Query database and calculate the datetime difference to get timedelta, which gives number of days, hours, and seconds. (https://docs.python.org/2/library/datetime.html)

6. Send email via SMTP server for all user's last login > 20 days. (https://docs.python.org/2/library/smtplib.html)

7. Create separate user account on system. (https://pypi.python.org/pypi/python-crontab)

8. Schedule script on crontab to run on some interval using new user account.

 

Can be done in less than 100 lines. (Unless you want to use the ORM to map all the tables.)

 

Deploy on some cloud instance

1. Buy a cloud instance for $5 per month or less.

2. Setup SSL certificates for MySQL server master and slave. (Self-signed root CA is ok)

3. Setup Iptables to allow cloud instance to connect on MySQL port.

4. Setup MySQL slave replication.

5. Write automation script that use slave replication server. (Which also double as backup)

Edited by trickyloki3

Share this post


Link to post
Share on other sites

Easy mate, use http://mailchimp.com/

 

It's free until you reach 2,000 emails/subscribers. You simply create a list and then you populate the list with emails either from a csv/text file, excel, google contacts, etc. :)

 

There's also a limit of 12,000 emails per month.

Edited by Kong

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.