Send mail in Windows without Outlook - Solved (use: Sarah Reichelts smtp library)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
zgdzgdzgd
Posts: 20
Joined: Wed Nov 22, 2017 1:26 pm

Send mail in Windows without Outlook - Solved (use: Sarah Reichelts smtp library)

Post by zgdzgdzgd » Thu Nov 23, 2017 7:20 am

I can't any good example to send simple mail via smtp in windows OS. For example i have a vbs script like this:

Code: Select all

Set MyEmail=CreateObject("CDO.Message")

MyEmail.Subject="test"
MyEmail.From="my@email.com"
MyEmail.To="my@email.com"
MyEmail.TextBody="Testing one two three."

MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'SMTP Server
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.kggroup.eu"

'SMTP Port
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 

MyEmail.Configuration.Fields.Update
MyEmail.Send

set MyEmail=nothing
This is simple way to send a test mail and in works perfectly in any windows os, i need to make a same thing in a livecode standalone program. Also i'am using LiveCode Community edition so this option to send mail using livecode might be only for commercial version of live code ?
Last edited by zgdzgdzgd on Mon Nov 27, 2017 4:19 pm, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Send mail in Windows without Outlook

Post by FourthWorld » Thu Nov 23, 2017 8:10 am

If Windows is all you need you can call that script from LiveCode's shell function.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

zgdzgdzgd
Posts: 20
Joined: Wed Nov 22, 2017 1:26 pm

Re: Send mail in Windows without Outlook

Post by zgdzgdzgd » Thu Nov 23, 2017 8:14 am

If i do that it will not be a standalone program and will require .exe file and .vbs file. I need to make it in one standalone .exe without any dependencies or .vbs files.
FourthWorld wrote:
Thu Nov 23, 2017 8:10 am
If Windows is all you need you can call that script from LiveCode's shell function.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Send mail in Windows without Outlook

Post by FourthWorld » Thu Nov 23, 2017 9:04 am

By its very nature, mail will require she other software.

Perhaps simpler to consider writing an API on a remote server and calling that. At least that would keep the local install requirements minimal, and reduce the likelihood of customers not having required components.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

zgdzgdzgd
Posts: 20
Joined: Wed Nov 22, 2017 1:26 pm

Re: Send mail in Windows without Outlook

Post by zgdzgdzgd » Thu Nov 23, 2017 9:45 am

I have few examples made in macro scheduler stand alone .exe programs sending mails without any dependencies so i know it's possible, i'am just wondering is possible in livecode because i want to switch from macro scheduler scripting to livecode, but i'am missing functionality from macro scheduler (like mail sending). I tried search for similar function in livecode but i just can't find any.
FourthWorld wrote:
Thu Nov 23, 2017 9:04 am
By its very nature, mail will require she other software.

Perhaps simpler to consider writing an API on a remote server and calling that. At least that would keep the local install requirements minimal, and reduce the likelihood of customers not having required components.

zgdzgdzgd
Posts: 20
Joined: Wed Nov 22, 2017 1:26 pm

Re: Send mail in Windows without Outlook

Post by zgdzgdzgd » Thu Nov 23, 2017 9:52 am

i uploaded a good example compiled .exe file you can test in virtual box it runs on any windows os , i tested it in winxp sp3

https://tmpfiles.org/dl/1177/sendmailexample.exe

or

https://file.town/download/ewvja4j2gjy0b7umw5en46qt5
FourthWorld wrote:
Thu Nov 23, 2017 9:04 am
By its very nature, mail will require she other software.

Perhaps simpler to consider writing an API on a remote server and calling that. At least that would keep the local install requirements minimal, and reduce the likelihood of customers not having required components.

zgdzgdzgd
Posts: 20
Joined: Wed Nov 22, 2017 1:26 pm

Re: Send mail in Windows without Outlook

Post by zgdzgdzgd » Thu Nov 23, 2017 1:07 pm

i made a short video showing how standalone mailer works i need same example for livecode

http://youtu.be/TEX2LaNJKAI?hd=1
FourthWorld wrote:
Thu Nov 23, 2017 9:04 am
By its very nature, mail will require she other software.

Perhaps simpler to consider writing an API on a remote server and calling that. At least that would keep the local install requirements minimal, and reduce the likelihood of customers not having required components.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Send mail in Windows without Outlook

Post by bogs » Thu Nov 23, 2017 4:14 pm

Sounds like the dictionary entry for revMail to me, except for the automatic send part in the script (read the last line of the comments).
Use the revMail command to create an email message from within a stack.
Parameters:
address - A string consisting of one or more email addresses, separated by commas. These addresses appear in the 'To:' header of the email message.
ccAddress - A string consisting of one or more email addresses, separated by commas. These addresses appear in the 'Cc:' header of the email message.
mailSubject - A string consisting of a single line. This text appears in the 'Subject:' header of the email message.
messageBody - A string. This text appears in the 'body' of the email message.

Comments:
When LiveCode executes the revMail command, the user's email program is opened (if necessary) and a new email message with the specified parameters is created. The user can change any of the settings before sending the message, and the message is not sent automatically: the user must explicitly send it (for example, by clicking a 'Mail' button in the email program).
Other than that, I would suspect you could put all the .vbs stuff your already using into a field, or variable or property, then save it to a temp file when called, or use shell to call those commands to call it directly from the field/ variable/ property. (not tested out, just theory).

Other than those two options, the only other person I have heard of coming up with a solution like what your talking about is Sarah Reichelt.
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Send mail in Windows without Outlook

Post by FourthWorld » Thu Nov 23, 2017 5:22 pm

@Bogs: revMail opens the user's email client with the various fields pre-filled. It is not an SMTP client in itself.

@zgdzgdzgd: Email is never entirely self-contained. At a minimum it requires an SMTP server, and the socket support to reach it. Some machines may have software installed to limit certain network traffic, such as email, to prevent the machine from being used as part of a botnet. In some environments routers may be similarly configured. And even the simplest solution will still require some means for the user to enter their SMTP info, so even then it's not entirely seamless.

If the VB script you have does exactly what you need,as Bogs noted it needn't be in a separate physical file. You can pass the script directly to the shell function.

There's an SMTP library floating around in the LC community, but I've never used it and I'm not sure how well it's maintained given how specialized such a need is.

When I need to allow the user to send a message I either use revMail to present a filled-in mail form that they can review before sending, or call an API on one of my servers for more specialized needs.

Personally, I would never attempt to send mail through a user's SMTP server without their explicit review and approval. And if I discovered software doing that I would uninstall it immediately.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Send mail in Windows without Outlook

Post by bogs » Thu Nov 23, 2017 8:00 pm

FourthWorld wrote:
Thu Nov 23, 2017 5:22 pm
@Bogs: revMail opens the user's email client with the various fields pre-filled. It is not an SMTP client in itself.
Yup, thats why I pointed out
Sounds like the dictionary entry for revMail to me, except for the automatic send part in the script (read the last line of the comments).
As you rightly point out, I also would never try to send an email without the users knowledge, so just in case that is all he is interested in, revMail should suffice and is built in.

The only out of the box smtp server component I know of in Lc is in the Lc server group, as this lesson discusses. I didn't mention this previously, as it did not sound like it would be of use in this situation.
FourthWorld wrote: There's an SMTP library floating around in the LC community, but I've never used it and I'm not sure how well it's maintained given how specialized such a need is.
I am thinking this must be the one linked to Sarah, I also don't know how well maintained it is.

HAPPY THANKSGIVING ALL !! (to those that celebrate it).
Image

matthiasr
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 190
Joined: Sat Apr 08, 2006 7:55 am
Location: Lübbecke, Germany
Contact:

Re: Send mail in Windows without Outlook

Post by matthiasr » Fri Nov 24, 2017 12:53 am

If you have a LC Indy or Business license you can use the tsNet external, which is included in the commercial licenses, to do such a task.

If not, you can use Sarah Reichelts smtp library (supports even HTML)
https://github.com/trozware/rev_stacks/ ... y_demo.rev
or Chip Walter´s altEmailHarenss stack, which uses Shao Seans smtp library
https://dl.qck.nu//?dl=altEmailHarness.rev

Both library aren´t maintained anymore and i am pretty sure they do not work with smtp servers which require TLS. I am still using Sarah´s library for some of our inhouse tools. But we are migrating all of your tools, which need to send notifications emails, to tsNet external.

Btw.: MacroScheduler from MjtNet is a great tool. I am using it from its beginning.

Regards,
Matthias

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Send mail in Windows without Outlook

Post by AxWald » Fri Nov 24, 2017 2:28 pm

Hi,

this may not be what you're looking for, but I really can recommend MailAlert for standalone mail sending in Win. It encrypts the mail password, and supports StartTLS & SSL/TLS, as well as attachments. And is small, simple & reliable.
But it comes as an extra application (3 MB), and is called via Shell.

Any other tools I tried (some mentioned above) are either outdated beyond help or failed me sooner or later.

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

zgdzgdzgd
Posts: 20
Joined: Wed Nov 22, 2017 1:26 pm

Re: Send mail in Windows without Outlook

Post by zgdzgdzgd » Mon Nov 27, 2017 4:16 pm

Thank you, very much matthiasr this is code example that i was looking for. Sarah Reichelts smtp library is a great tool, and works even in old Windows XP! I just tested it on WinXP virtual box. I searched for this example everywhere it's a discovery for me. It doesn't matter that this doesn't support TLS for general purposes it's ok, because you will not send a sensitive information using it.

I'am using a free livecode community edition so tsNet external mail sender doesn't work on it. I'am considering of buying live code comercial version to get all functionality.
http://lessons.livecode.com/m/4071/l/68 ... t-external

Anyway thank you again, you just saved my trust in livecode :)
matthiasr wrote:
Fri Nov 24, 2017 12:53 am
If you have a LC Indy or Business license you can use the tsNet external, which is included in the commercial licenses, to do such a task.

If not, you can use Sarah Reichelts smtp library (supports even HTML)
https://github.com/trozware/rev_stacks/ ... y_demo.rev
or Chip Walter´s altEmailHarenss stack, which uses Shao Seans smtp library
https://dl.qck.nu//?dl=altEmailHarness.rev

Both library aren´t maintained anymore and i am pretty sure they do not work with smtp servers which require TLS. I am still using Sarah´s library for some of our inhouse tools. But we are migrating all of your tools, which need to send notifications emails, to tsNet external.

Btw.: MacroScheduler from MjtNet is a great tool. I am using it from its beginning.

Regards,
Matthias

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”