Skip to content

Instantly share code, notes, and snippets.

@varlen
Created December 8, 2015 11:12
Show Gist options
  • Save varlen/376afb63378754d9b64e to your computer and use it in GitHub Desktop.
Save varlen/376afb63378754d9b64e to your computer and use it in GitHub Desktop.
Write the email then inject this JavaScript on the page to schedule an email submission.
// No Gmail, o ID do botao sempre muda quando a pagina é atualizada
// Mudar o id na linha abaixo
btnElementID = '';
btn = document.getElementById(btnElementID);
intervalID = window.setInterval( function checkTime() {
// https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Date
var send_on = new Date( 2015,11,8,6,0 );
var now = new Date();
if ( now.getTime() > send_on.getTime() ) {
console.info( 'Mandei!' ); // Sent
btn.click();
window.clearInterval( intervalID );
} else {
console.log( 'Ainda não ( '+ send_on +' ) > ( ' + now +' )'); // Not sent yet
}
}, 5000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment