Advertisement
Guest User

enviar correo desde cmd

a guest
Oct 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.63 KB | None | 0 0
  1. @echo off && color f && MODE CON COLS=70 LINES=25
  2. echo.
  3. echo --------------------------------------------------------------------
  4. echo                         ENVIAR CORREO DESDE CMD
  5. echo --------------------------------------------------------------------
  6. echo.
  7. set /p para= Para:
  8. echo.
  9. set /p asunto= Asunto:
  10. echo.
  11. set /p mensaje= Mensaje:
  12. echo.
  13. echo.
  14. echo.
  15. color e
  16. FOR /L %%A IN (1,1,50) DO (
  17. echo -----------------------------PROCESANDO-----------------------------
  18. )
  19. echo.
  20.  
  21. ::HERE STARTS THE PROCESS::::::::::::::::::::::::::::::::::::::::::::
  22.  
  23. echo Set MyEmail=CreateObject("CDO.Message") >> temp.vbs
  24.  
  25. echo Const cdoBasic=0 'Do not Authenticate >> temp.vbs
  26. echo Const cdoAuth=1 'Basic Authentication >> temp.vbs
  27.  
  28. echo MyEmail.Subject = "%asunto%" >> temp.vbs
  29. echo MyEmail.From    = "<antonioavelar962018@gmail.com>" >> temp.vbs
  30. echo MyEmail.To      = "<%para%>" >> temp.vbs
  31. echo MyEmail.TextBody= "%mensaje%" >> temp.vbs
  32.  
  33. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 >> temp.vbs
  34.  
  35. echo 'SMTP Server >> temp.vbs
  36. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.gmail.com" >> temp.vbs
  37.  
  38. echo 'SMTP Port >> temp.vbs
  39. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 >> temp.vbs
  40.  
  41. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 >> temp.vbs
  42.  
  43. echo 'Your UserID on the SMTP server >> temp.vbs
  44. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "antonioavelar962018@gmail.com" >> temp.vbs
  45.  
  46. echo 'Your password on the SMTP server >> temp.vbs
  47. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "polloasado" >> temp.vbs
  48.  
  49. echo 'Use SSL for the connection (False or True) >> temp.vbs
  50. echo MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True >> temp.vbs
  51.  
  52. echo MyEmail.Configuration.Fields.Update >> temp.vbs
  53. echo MyEmail.Send >> temp.vbs
  54.  
  55. echo Set MyEmail=nothing >> temp.vbs
  56.  
  57. :: END OF THE PROCESS::::::::::::::::::::::::::::::::::::::::::::
  58.  
  59. ::HIDING XD
  60. ::attrib +h temp.vbs
  61.  
  62. if exist temp.vbs (
  63.    rem file exists
  64. ::echo file exists
  65. call temp.vbs
  66. color a
  67. cls
  68. echo.
  69. echo -------------------------MENSAJE ENVIADO!!!-------------------------
  70. echo.
  71. del /f /q temp.vbs
  72. ) else (
  73.    rem file doesn't exist
  74. ::echo file doesn't exist
  75. color c
  76. echo -------------------------------ERROR--------------------------------
  77. )
  78.  
  79. echo.
  80. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement