Page 1 of 1
Commandline email client with SSL SMTP authentication?
Posted: Sun Jun 29, 2008 4:21 pm
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.
Posted: Sun Jun 29, 2008 6:37 pm
by Kale
Posted: Sun Jun 29, 2008 9:40 pm
by ricardo
Thanks, i will look at blat.
Posted: Sun Jun 29, 2008 11:18 pm
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

Posted: Mon Jun 30, 2008 1:23 am
by rsts
That looks cool.
Have to see if it will work with GMail.
Thanks
Posted: Mon Jun 30, 2008 4:08 am
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.
Posted: Wed Nov 05, 2008 10:19 am
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
Posted: Wed Jun 24, 2009 11:34 am
by Michael Vogel
Did anyone made a working example for using gmail with (or even without

) stunnel?
Michael
Re: Commandline email client with SSL SMTP authentication?
Posted: Tue May 03, 2011 8:20 pm
by Wladek
Michael Vogel wrote:Did anyone made a working example for using gmail with (or even without

) 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
Re: Commandline email client with SSL SMTP authentication?
Posted: Tue May 03, 2011 9:24 pm
by tinman
I know I'm a bit late but msmtp (
http://msmtp.sourceforge.net/) is also pretty good.
Re: Commandline email client with SSL SMTP authentication?
Posted: Tue Nov 21, 2017 11:17 pm
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
Re: Commandline email client with SSL SMTP authentication?
Posted: Sat Nov 25, 2017 11:32 pm
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..
Re: Commandline email client with SSL SMTP authentication?
Posted: Sun Dec 10, 2017 9:28 pm
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