Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@stojg
Last active September 26, 2015 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stojg/1106860 to your computer and use it in GitHub Desktop.
Save stojg/1106860 to your computer and use it in GitHub Desktop.
Sending emails via your gmail account to my email
#/bash/bin
php -r 'function gp($a=false){$b=shell_exec("stty -g");if($a===false){shell_exec("stty -echo");$c=rtrim(fgets(STDIN),"\n");}else{shell_exec("stty -icanon -echo min 1 time 0");$c="";while(true){$d=fgetc(STDIN);if($d==="\n"){break;}else if(ord($d)===127){if(strlen($c)>0){fwrite(STDOUT,"\x08 \x08");$c=substr($c,0,-1);}}else{fwrite(STDOUT,"*");$c.=$d;}}}shell_exec("stty ".$b);return $c;}echo"Your gmail @: ";$ha=fopen("php://stdin","r");$f=trim(fgets($ha));echo"Your gmail pass: ";$p=gp(1);echo"\nWhat do you want(enters sends message): ";$m=trim(fgets($ha));function s($c,$m){fputs($c,$m."\r\n");}function r($c){return fgets($c,4096);}function e($m){return base64_encode($m);}function m($f,$p,$m){$r="g@stojg.net";$n="\r\n";$c=fsockopen("smtp.gmail.com",587,$z,$y,10);r($c);s($c,"HELO");r($c);s($c,"STARTTLS");r($c);stream_socket_enable_crypto($c,true,STREAM_CRYPTO_METHOD_TLS_CLIENT);s($c,"HELO");r($c);s($c,"AUTH LOGIN");r($c);s($c,e($f));r($c);s($c,e($p));r($c);s($c,"MAIL FROM: <$f>");r($c);s($c,"RCPT TO: <$r>");r($c);s($c,"DATA");r($c);s($c,"To: $r{$n}From: $f{$n}Subject: Contact{$n}To: $r{$n}From: $f{$n}$n{$m}$n.");r($c);s($c,"QUIT");$qc=r($c);fclose($c);if($qc==221){return 1;}}echo((m($f,$p,$m))?"Sent":"Fail!")."\n";'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment