texaspete
New Member
Actually I am an old member. just been working hard for a long time
Posts: 21
|
Post by texaspete on Dec 4, 2019 8:43:14 GMT -5
I saw some code that would allow you to send an email using Liberty basic.
Does any one remember where it was.
Texas Pete
Thank all of you.
|
|
|
Post by wexhammer on Dec 4, 2019 8:55:56 GMT -5
'- email demo
'- be sure to use %20 for all blank spaces
'- mailto=recipient's email address
'- ?subject=subject field
'- &body=content
'- &cc=carbon copy to recipients
'- &bcc=blind carbon copy to recipients
nomainwin
msg$="mailto:carlg@libertybasic.com"
msg$=msg$+"?Subject=Liberty%20BASIC"
msg$=msg$+"&body=Your%20Text%20HERE"
msg$=msg$+"&cc=name@domain.com"
msg$=msg$+"&bcc=somebody@what.net"
'easiest way:
'run "explorer.exe " + chr$(34) + msg$ + chr$(34)
'or, better way:
call RunThis msg$,0
end
sub RunThis RunFile$, hWindow
RunFile$=RunFile$+chr$(0)
lpOperation$ = "open" + chr$(0)
lpParameters$ = "" + chr$(0)
lpDirectory$ = "" + chr$(0)
nShowCmd = _SW_SHOWNORMAL
calldll #shell32, "ShellExecuteA", _
hWindow as long, _ 'parent window
lpOperation$ as ptr, _ 'open or print
RunFile$ as ptr, _ 'file name
lpParameters$ as ptr, _ 'null
lpDirectory$ as ptr, _ 'default directory
nShowCmd as long, _ 'show window flag
result as long
if result <= 32 then notice "Error, Address Failure!"
end sub
|
|
|
Post by Rod on Dec 4, 2019 9:22:27 GMT -5
This was published in the newsletters. It was an article contributed by Brad Moore and Alyce. I post it here because such resources are getting harder and harder to find.
An easy way to send mail People often ask "How can I send a formatted email message from Liberty Basic?" (Well once someone asked that - but it wasn't me... well it might have been). Moving on... I remembered that Alyce had integrated this very feature into one of her earlier Integrated Development Enviroments that she had written completly in Liberty Basic (version 2.02 at the time). It was a for-runner of the current Open Source LB Editor, which it inspired. I recently posted this on the LB list in response to a real question - and wanted to share it with the larger audience. As I mentioned I gleaned this little gem from Alyce's EditWorks of the old LB2 days. It was calling the 16bit dll calls, so I converted it to 32bit and polished it up a little for LB3. Alyce mentioned later that she too had recieved it from someone else even earlier. My thanks goes out to those who blaze the trail before us... 'email.bas 'based on the work done by Alyce Watson in EditWorks (Thanks ' you are an inspiration to all of us!) 'Runs on LB3.x 'Modifacations by Brad Moore (blame Alyce if it don't work) ;-)
'email.bas 'based on the work done by Alyce Watson in EditWorks (Thanks ' you are an inspiration to all of us!) 'Runs on LB3.x 'Modifacations by Brad Moore (blame Alyce if it don't work) ;-)
[WindowSetup] NOMAINWIN WindowWidth = 136 : WindowHeight = 73 UpperLeftX = INT((DisplayWidth-WindowWidth)/2) UpperLeftY = INT((DisplayHeight-WindowHeight)/2)
[ControlSetup]
button #main.email, "Email Me",[email],UL, 10, 10, 105, 25
Open "Window Title" for Dialog as #main
print #main, "trapclose [quit]" print #main, "font ms_sans_serif 10"
hWnd = hWnd(#main)
[loop] Wait
[quit] close #main : END
[email] 'The email address is ficticious, so don't bother pressing send... file$="mailto:whoever@coolISP.com?Subject=I want to be your friend" result = ShellExecute(hWnd, file$, "") if result <= 32 then notice "Error, Address Failure!" goto [loop]
Function ShellExecute(hWnd, file$, dir$)
parameter = _SW_SHOWNORMAL ' set up for viewing lpszOp$ = "open" + Chr$(0) ' "open" or "print" lpszFile$ = file$ + Chr$(0) lpszDir$ = dir$ + Chr$(0) lpszParams$= "" + Chr$(0)
CallDLL #shell32, "ShellExecuteA", _ hWnd As ulong, _ lpszOp$ As Ptr, _ lpszFile$ As Ptr, _ lpszParams$ As Ptr, _ lpszDir$ As Ptr, _ parameter As Long, _ result As Long
ShellExecute = result
End function
|
|
|
Post by wexhammer on Dec 4, 2019 9:48:12 GMT -5
Were has Alyce disapeared to?
|
|
texaspete
New Member
Actually I am an old member. just been working hard for a long time
Posts: 21
|
Post by texaspete on Dec 4, 2019 11:56:50 GMT -5
Just wanted the thank all of you for the little bit of Code. Rod the code by alyce brought up the message center from thunderbird, which I did not expect. I already have a web tool that I wrote that can write web pages. I may try to integrate Alyce's code to send multiple emails to different customers.
Texas Pete Ye Ha!
|
|
|
Post by Rod on Dec 4, 2019 14:59:08 GMT -5
It’s winter, asleep in her snowbound, castle, tower, deep in the forrest awaiting a white knight to rekindle her interest.
|
|
|
Post by flotul on Jan 5, 2022 5:40:46 GMT -5
Hi there,
Did anyone already handle the receiving of emails?
I have a need to receive an email and read its subject field.
Can this be done with LB please?
|
|
|
Post by atomose on Jan 5, 2022 20:07:03 GMT -5
should be good if someone with good level in LB can creat a simple email gui with adresse, subjet and send.
Same for a server exemple or local server .... we have thousand of codes in this forum but when we need usefull utilities they give us link or hard level codes to understand. we are not pro and lot of us need help to understand codes. So pls, make so usefull codes like email, server etc ... thx
(maybe Carl can help us ? ^^ )
|
|
|
Post by Rod on Jan 6, 2022 3:07:26 GMT -5
Well the question was about receiving an email. Does it need to be an email? We have a Scandinavian farmer who has successfully used SMS to automate the sending and receiving of info between systems. It is a paid for service but he has automated it within Liberty code. It is a herd of cows that sms their milking parlour behaviour and get feed and brushing service in return.
|
|
|
Post by Chris Iverson on Jan 6, 2022 19:25:43 GMT -5
I can try to whip up a sample, but it's likely not going to be simple.
You have to use code to connect to the internet, and then you have know how to communicate using an email retrieval protocol like POP3.
And it gets even more complicated if you're using a general public email service like gmail or hotmail, where encryption and special account configurations are required.
|
|
|
Post by flotul on Jan 7, 2022 13:36:35 GMT -5
Well, thanks a lot for your answers.
I'm not sure I want to go that complicated if it looks like it will be so...
I have a one shot project so it is not worse to spend too much time on it.
|
|
|
Post by klewlis on Jan 14, 2022 14:02:14 GMT -5
What if you were using an email client, Outlook for example.
It should be possible to open the email client with LB, and then would it be possible, once the client downloaded current emails, to search the subject lines of the emails in the inbox for one you were expecting? Or possibly search by sender?
this is not something I am currently trying to do, but it is in my future projects folder.
|
|
|
Post by rodsweb on Jan 16, 2022 7:15:13 GMT -5
On the off chance someone can help. I rent my own internet server ($80 per year). emails to the address in the form x@myweb.com are saved on the server which I can easily access using LB. The server receives emails and stores then on the server. I would like to download the emails directly using LB. I need to know the format of the emails on the server which are compacted. So my question is has anyone have some code that would allow email access? It may also be a solution for texaspet. I believe the emails on the server are in "dovecot" format/programme.
|
|