Skip to content

Instantly share code, notes, and snippets.

@Durek
Last active September 27, 2020 13:55
Show Gist options
  • Save Durek/a0f922ee7d6dcbb3256d6940b355df73 to your computer and use it in GitHub Desktop.
Save Durek/a0f922ee7d6dcbb3256d6940b355df73 to your computer and use it in GitHub Desktop.
Autmagically activate steam accounts
const mailin = require('mailin');
const request = require('request');
require('log-timestamp')(function() { return '[' + new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000).toISOString().replace(/T/, ' ').replace(/\..+/, '') + '] %s'; });
const afterLink = ['Steam requires a verified email address so you can take full advantage of Steam', 'Steam setzt eine verifizierte E-Mail-Adresse voraus, um von allen'];
const linkStart = 'https://store.steampowered.com/account/newaccountverification?stoken=';
mailin.start({
port: 25,
disableWebhook: true,
logLevel: 'error'
});
mailin.on('message', function (connection, data, content) {
var mail = data.text;
if (mail.indexOf(linkStart) >= 0) {
mail = mail.substring(mail.indexOf(linkStart));
for (var i = 0; i < afterLink.length; i++) {
if (mail.indexOf(afterLink[i]) >= 0) {
mail = mail.substring(0, mail.indexOf(afterLink[i]));
break;
}
}
mail = mail.replace(/(\r\n\t|\n|\r\t)/gm,""); //remove any line break that survived
confirm(mail, data.to[0].address);
} else {
console.log('Received mail for ' + data.to[0].address + ', content: ' + data.text);
}
});
async function confirm(link, receiver) {
request(link, function (error, response, body) {
if (!error) {
console.log('Confirmed mail for ' + receiver);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment