Page 1 of 1
Send mail in Windows without Outlook - Solved (use: Sarah Reichelts smtp library)
Posted: Thu Nov 23, 2017 7:20 am
by zgdzgdzgd
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 ?
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 8:10 am
by FourthWorld
If Windows is all you need you can call that script from LiveCode's shell function.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 8:14 am
by zgdzgdzgd
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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 9:04 am
by FourthWorld
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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 9:45 am
by zgdzgdzgd
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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 9:52 am
by zgdzgdzgd
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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 1:07 pm
by zgdzgdzgd
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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 4:14 pm
by bogs
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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 5:22 pm
by FourthWorld
@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.
Re: Send mail in Windows without Outlook
Posted: Thu Nov 23, 2017 8:00 pm
by bogs
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).
Re: Send mail in Windows without Outlook
Posted: Fri Nov 24, 2017 12:53 am
by matthiasr
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
Re: Send mail in Windows without Outlook
Posted: Fri Nov 24, 2017 2:28 pm
by AxWald
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!
Re: Send mail in Windows without Outlook
Posted: Mon Nov 27, 2017 4:16 pm
by zgdzgdzgd
Thank you, very much
matthiasr this is code example that i was looking for. S
arah 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