3

I am working on windows and I have enabled telnet client

In cmd prompt:

$telnet smtp.gmail.com 587
220 mx.google.com ESMTP dk3sm50678627pbc.32 - gsmtp
$Helo
250 mx.google.com at your service
$ mail from: <myuser@gmail.com>
530 5.7.0 Must issue a STARTTLS command first. dk3sm50678627pbc.32 - gsmtp
$ STARTTLS
220 2.0.0 Ready to start TLS
$ mail from:
C:\Users\{myuser}>
Connection to host lost.

Don't know What is the problem ?

Can anyone help me out , how i can send emails from gmail server using telnet from command line >

3 Answers3

2

smtp.gmail.com requires TLS. The basic telnet client that comes with windows does not know how to negotiate TLS with a server. You may want to use openssl instead, which is able to negotiate TLS. See http://www.madboa.com/geek/openssl/#cs-smtp for an example of how to do this.

mti2935
  • 11,465
  • 3
  • 29
  • 33
-1

The gmail smtp must use smtp auth before you sending your email. The smtp auth need username and password.

see this link blow if you can read in Chinese. http://linxucn.blog.51cto.com/1360306/837365

Last I sugguest you use java to ask gmail smtp server to send email, It will be more easy , becasue you needn't encode the smtp auth to BASE64 or anything else.

GOGOGO, good luck :)

Chair
  • 362
  • 2
  • 8
  • I don't want to do this in java , all what i want to do is through telnet how can i send email using gmail –  Oct 10 '13 at 08:44
  • 1
    It's very difficult to send a email by telnet to use gmail as a MTA. in Linux , you must do it yourself. learn the smtp auth and do that by expect lang. IF gmail NEEDN'T SMTP AUTH, you can do it, but now, just use java or anything else will make you work. – Chair Oct 18 '13 at 04:25
-1

Put into a VBS file, ie sendmail.vbs.

Set emailObj      = CreateObject("CDO.Message")
emailObj.From     = "cat@gmail.com"

emailObj.To       = "cat@gmail.com"

emailObj.Subject  = "Test CDO"
emailObj.TextBody = "Test CDO"

emailObj.AddAttachment "c:\windows\win.ini"

Set emailConfig = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")    = 2  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")      = true 
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")    = "cat"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")    = "Ccat1"
emailConfig.Fields.Update

emailObj.Send

If err.number = 0 then Msgbox "Done"

At Google's web site for GMail you have to turn this feature on for CDO to work.

At your Gmail page click Settings - Accounts and Import - Other Google Account Settings - [At very bottom of page] Allow less secure apps.

Also from memory you also have to click a link in an email the first time you use it (it's been a few years).

ACatInLove
  • 530
  • 2
  • 5