Email from within a program

User avatar
GeorgeMcGinn
Posts: 435
Joined: Sat Sep 10, 2016 6:37 am
My devices: IPad Pro 10.5in
IMac
Linux i386
Windows 7 & 10
Location: Venice, FL
Flag: United States of America
Contact:

Re: Email from within a program

Post by GeorgeMcGinn »

Rbytes, I will take a look into this, as with your SB Notes 1.1 you are only building the information in the first 3 lines below, and calling Apple's email program to send the real email.

There is nothing wrong in doing it this way, as a copy is saved in the SENT folder. But the code below is the same thing SB Notes does.

If you are looking to bypass the browser and JavaScript code, your program needs to know both the POP/POP3 and SMTP addresses to send and receive emails, and you need to add a field for password.

If I can find them, I've written my own email programs in both PERL and PHP. I'm not sure that SB has access to POP/SMTP, or passing the password to allow you access to.

A possible work-a-round may be to create a form in SB with the emails (to, cc and bcc), subject, body and signature if desired. You would need to then setup a form in SB's Browser, and using the mailto: you would make these "hidden fields" and you should be able to select and execute the SEND immediately, which would not display the form on your SB console. You can save the email in your SB app, and it will be put into iMail's SEND mailbox as well.

I've been restoring my Windows XP system as my iMac died months ago, so I will look for the web code I used to send emails without calling up a mail client program. I even think I have one written in PowerBASIC.

The main issue will be if Mr. K. has not blocked access to the mail server, or didn't include them in either the Browser or the HTTPD statements (remember he had issues with FTP because there was no support for it in the HTTPD protocols?

Give me some time and I'll post my findings here.

If anyone has already accomplished this or has failed, please post it here as well. All information will be helpful.



rbytes wrote:
Fri Jan 25, 2019 11:08 pm
The technique requires more than just a single line of code, because it calls JavaScript in a Smart Basic browser window. But no need to reinvent the wheel. Everything you need is here.

Try this code. Substitute your own choice of email, subject and body in the first 3 lines. Then run the program. It will open a new Mail message with the address, subject and body, all ready to press Send.

Code: Select all

email$="somebody@somewhere.ca"
subject$="Your Kijiji ad"
body$="I am interested in your 76 Mustang. Will you negotiate on the price?"

a1$="<html><head><script type="&q$&"text/javascript"&q$&"> function mymessage() { location.href="
a1a$=CHR$(34)&"mailto:"
a1b$=email$!a1c$="?subject="
a2$=subject$
a3$="&body="
a4$=body$
a5$=CHR$(34)&";} </script></head><body onload="&q$&"mymessage()"&q$&"></body></html>"
a$=a1$&a1a$&a1b$&a1c$&a2$&a3$&a4$&a5$
BROWSER "n" AT 0,0 SIZE 100,100
BROWSER "n" TEXT a$
end
George McGinn
Computer Scientist/Cosmologist/Writer/Photographer
Member: IEEE, IEEE Computer Society
IEEE Sensors Council & IoT Technical Community
American Association for the Advancement of Science (AAAS)

Post Reply