Local SMTP server

No need to worry about going "off topic" here
Forum rules
This forum is for general chit-chat, not necessarily APL-related. However, it's not for spam or for offensive or illegal comments.

Local SMTP server

Postby kai on Tue Dec 29, 2015 7:46 pm

I am going crazy!

Yesterday I discovered by accident that one of my email addresses (in that case info@aplwiki.com) does not work anymore. (According to the provider it cannot work but I insist it did work for years, but that's another story altogether).

I made the suggested changes and now it's fine again. However, I realized that I really want to check my web sites and my email addresses every now and then automatically, running constantly in the background, keeping a low profile unless something goes wrong.

I wrote this in exactly one hour. I then spent more than 3 hours investigating how to send an email from my Windows 10 box. Okay 2:45 hours, the rest of the time I spent on investigating how to send an SMS.

It did not get me anywhere.

Has anybody worked out how to do this?

This was a 10-minute task under Windows XP, it got difficult under W7, but now with W10 it seems that it is impossible with on-board equipment. We are really improving in terms of productivity thanks to Microsoft.
User avatar
kai
 
Posts: 137
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: Local SMTP server

Postby Dick Bowman on Wed Dec 30, 2015 11:09 am

Not sure exactly what you want to achieve, but this code sends me email quite regularly from a W10/64 box

Code: Select all
  ∇ a SendMail(to from subject body);⎕IO;⎕ML;⎕USING;MyMail;Mailer;Cred;server;port;id;password
    ⍝ Send mail - variant of MBaas version in Dyalog forum
      ⎕IO ⎕ML←0 3
      ⎕USING←'System.Net.Mail,System.dll' 'System,System.dll' 'System.Net,system.dll'
      server port id password←a
      MyMail←⎕NEW MailMessage
      MyMail.To.Add ⎕NEW MailAddress(⊂to)
      MyMail.From←⎕NEW MailAddress(⊂from)
      MyMail.Subject←subject
      MyMail.Body←body
      Mailer←⎕NEW SmtpClient(server(Convert.ToInt32 port))
      Mailer.EnableSSL←1
      Cred←⎕NEW NetworkCredential(id password)
      Mailer.UseDefaultCredentials←0
      Mailer.Credentials←Cred
      Mailer.Send MyMail
    ∇


As you can see - it's not my own work.
Visit http://apl.dickbowman.com to read more from Dick Bowman
User avatar
Dick Bowman
 
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm

Re: Local SMTP server

Postby kai on Wed Dec 30, 2015 2:09 pm

The APL part is (as usual) not the problem - for your APL code to work you need an SMTP server running on your local machine.

Under Windows XP you just started the SMTP server - job done.

Under W7 IIS v7 does not have an SMTP server anymore. It was however possible to activate it in IIS v6.

Under W10 IIS v6 is not available any more and cannot be installed either.

For your code to work you must have such a server running on your machine. Or do you specify another machine via the left argument?
User avatar
kai
 
Posts: 137
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: Local SMTP server

Postby hebens01 on Wed Dec 30, 2015 5:33 pm

In case you are working with an SMTP server on a different machine (or outside provider), I am very happy with the command line emailer available at:

http://caspian.dotconf.net/menu/Software/SendEmail/

This website is currently down, but the program is also available at:

http://freecode.com/projects/sendemail

From APL I am calling it with ⎕SH (or better yet the “Execute” function that is part of your CategoryAplTree project).

Here is an example where an email gets send from my.name@google.com to my.name@google.com via a Google Apps account.

sendEmail.exe -f "My Name <my.name@google.com>" -s smtp.gmail.com:587 -xu heiko.ebens@lucidium.com -xp PASSWORD -t heiko.ebens@lucidium.com -m " " -u "Test email"

There are a few other command line programs around, but this is the only one I could get working with various type of servers (including Microsoft Exchange).

Hope this help.
hebens01
 
Posts: 2
Joined: Wed Apr 01, 2015 10:38 pm

Re: Local SMTP server

Postby MBaas on Thu Dec 31, 2015 2:00 pm

I had fun with sending mail, too. :(
Finally ended up using http://mailgun.org - a professional, commercial service. Fortunately there is a free allowance of 10,000 emails/month which I never exceeded :-)
Note: you do not need to use that API, there also is a way to use their SMTP-Servers (as long as you have full control over your DNS-Records). So it may require a bit fiddling, but I found it worth it - since you can be sure that the mail will end up in an Inbox and not in spam ;-)
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: Local SMTP server

Postby kai on Fri Jan 01, 2016 5:58 pm

hebens01:
Thanks for that. I did not know that Google offers something that looks like a "portable SMTP" server.

I would love to use this, and it should be possible to avoid using the Perl stuff, but it seems that when ones uses Google Apps (I do) then this is not an option. Pity.


Michael:
That looks like a perfect solution, thanks. Cannot try yet because after adding the required DNS records one has to wait 24-48 hours. Grrmpf.
User avatar
kai
 
Posts: 137
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: Local SMTP server

Postby kai on Sat Jan 16, 2016 2:45 pm

For the record:

It is a perfect solution. The only hiccup was that the promised confirmation email never made it into my inbox. After having waited for four days I decided to give it a go without further ado and guess what: everything worked like a charm.

Thanks again Michael.
User avatar
kai
 
Posts: 137
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: Local SMTP server

Postby MBaas on Sat Jan 16, 2016 6:55 pm

Great, thanks for the feedback, Kai. I'm happy it helped :)
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany


Return to Chat

Who is online

Users browsing this forum: No registered users and 1 guest