Commandline email client with SSL SMTP authentication?

For everything that's not in any way related to PureBasic. General chat etc...
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Commandline email client with SSL SMTP authentication?

Post by ricardo »

Hello

I need to send some automatic emails from an email account that need SSL SMTP authentication.

Does anybody knows an email client that can be used from command line to achieve this task?

Thanks in advance.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

blat with stunnel maybe?
--Kale

Image
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Kale wrote:blat with stunnel maybe?
Thanks, i will look at blat.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

stunnel works from PB :)

Code: Select all

StunnelExe$ = "C:\Archivos de programa\stunnel\stunnel.exe"
 ; RunProgram(StunnelExe$,"-start","")
MySMTPServer.s = "127.0.0.1" 
MySMTPPort.l = 1099
MailTo.s = "receiver@mail.com"
MailFrom.s = "mymail@yahoo.com"
Subject.s = "testeando ssl"
MsgBody.s = "veamos"
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok 
  Debug PureSMTP_GetLastServerMessage() 
  PureSMTP_AddHeader("X-MSMail-Priority", "High")
  PureSMTP_AddHeader("Date", FormatDate("Y=%yyyy, M= %mm, D=%dd", Date()))
  Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, "","mymail@yahoo.com","password") 
  Debug PureSMTP_GetLastServerMessage() 
  PureSMTP_CloseSMTPConnection() 
Else
  Debug "stunnel not running"
EndIf
; RunProgram(StunnelExe$," -uninstall","")
In the stunnel.conf

i add this:

Code: Select all

[SMTP] 
accept = 127.0.0.1:1099 
connect = plus.smtp.mail.yahoo.com:465 
Just installed stunnel as service and now im able to use my smtp with ssl auth. Great!!

Thanks Kale :)
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

That looks cool.

Have to see if it will work with GMail.

Thanks
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

rsts wrote:That looks cool.

Have to see if it will work with GMail.

Thanks
Yes, it does.
I know because the example that i use was made for gmail, but i change it for yahoo.
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Post by KIKI »

ricardo wrote:
rsts wrote:That looks cool.

Have to see if it will work with GMail.

Thanks
Yes, it does.
I know because the example that i use was made for gmail, but i change it for yahoo.
Hi ricardo,
Could you give an example for gmail because i don't arrive to have a connection, with Puresmtp and my account in GMAil
Note i use Mailroam for my four email accounts
Thanks
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Did anyone made a working example for using gmail with (or even without :lol:) stunnel?

Michael
Wladek
User
User
Posts: 98
Joined: Mon Feb 23, 2009 4:01 pm
Location: Poland
Contact:

Re: Commandline email client with SSL SMTP authentication?

Post by Wladek »

Michael Vogel wrote:Did anyone made a working example for using gmail with (or even without :lol:) stunnel?
Michael
smtp.gmail.com
Port normal: 587 or 25
Port SSL : 465
---------------------------------------------

Code: Select all

StunnelExe$ = "C:\Archivos de programa\stunnel\stunnel.exe"
;if OsVersion()=NT/2000/XP   meaby
RunProgram(StunnelExe$,"-install","",#PB_Program_Wait)
delay(300)
RunProgram(StunnelExe$,"-start","",#PB_Program_Wait)
delay(300)
;endif
MySMTPServer.s = "127.0.0.1" 
MySMTPPort.l = 1099
MailTo.s = "receiver@mail.com"
MailFrom.s = "mymail@yahoo.com"
Subject.s = "testeando ssl"
MsgBody.s = "veamos"
If PureSMTP_OpenSMTPConnection(MySMTPServer, MySMTPPort) = #PureSMTP_Ok 
  Debug PureSMTP_GetLastServerMessage() 
  PureSMTP_AddHeader("X-MSMail-Priority", "High")
  PureSMTP_AddHeader("Date", FormatDate("Y=%yyyy, M= %mm, D=%dd", Date()))
  Status.l = PureSMTP_SendMail(MailTo, MailFrom, Subject, MsgBody, "","mymail@yahoo.com","password") 
  Debug PureSMTP_GetLastServerMessage() 
  PureSMTP_CloseSMTPConnection() 
Else
  Debug "stunnel not running"
EndIf
;if OsVersion()=NT/2000/XP   meaby
delay(300)
RunProgram(StunnelExe$," -stop","",#PB_Program_Wait)
delay(300)
RunProgram(StunnelExe$," -uninstall","",#PB_Program_Wait)
;endif
Somethink like this work better for my aplications
Last edited by Wladek on Wed May 04, 2011 11:52 am, edited 1 time in total.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: Commandline email client with SSL SMTP authentication?

Post by tinman »

I know I'm a bit late but msmtp (http://msmtp.sourceforge.net/) is also pretty good.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
langinagel
Enthusiast
Enthusiast
Posts: 131
Joined: Fri Jan 28, 2005 11:53 pm
Location: Germany
Contact:

Re: Commandline email client with SSL SMTP authentication?

Post by langinagel »

Just a question...after quite some times...

Is it possible to build an email client with stunnel and Purebasic in order to
- receive emails from an email server
- just fetch some messages with the correct attachment and
- disregard all other messages not with the correct attachment
???

Best regards
LN
https://www.doerpsoft.org

Boost. Work. Efficiency.
User avatar
tj1010
Enthusiast
Enthusiast
Posts: 623
Joined: Mon Feb 25, 2013 5:51 pm
Location: US or Estonia
Contact:

Re: Commandline email client with SSL SMTP authentication?

Post by tj1010 »

I've done it via a python proxy with an up to date CA file..

Bad thing about this thread is how useful it is to anyone with a lot of IPs for launching a highly profitable spam network..
The truth hurts.
infratec
Always Here
Always Here
Posts: 6818
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Commandline email client with SSL SMTP authentication?

Post by infratec »

Maybe a bit late ...

I compiled libcurl with imap included and replaced the original PB libcurl.lib.
So it is possible to fetch emails via imaps from a server.

I already told Fred that he should include imap, because it only increases the size of the lib by 30k

And the 's' is needed everywhere if you do something via TCP/IP today.

A year ago I already placed it on the wish list:
http://www.purebasic.fr/english/viewtop ... ilit=imaps

Bernd
Post Reply