Fake SMTP
-
That's fine if I test this, but I want to make sure no one ever accidentally sends an email to someone who isn't expecting this. Not testers, not newbies, and not me. If I use my own account and I leave for a new job I'd have to change the mail settings or get test emails for all eternity. I also want to be sure that an email is really send to the provided email address (but not actually delivered). Fake SMTP does a great job at this, but requires infrastructure which I don't currently have.
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
I understand from your initial post that you only want to test the mail features. The used mail server settings must be replaced before going live. The final SMTP server will be probably those of the company running the web site (or the SMTP server of their hoster if they did not have their own one) and a corresponding account (at best one created especially for the web service).
Quote:
but I want to make sure no one ever accidentally sends an email to someone who isn't expecting this.
That is a different problem and one of those that can't be achieved by 100 % (besides not supporting mails to be send to addresses entered on the page). It is a dangerous area. Once such a service is abused, the IP address of the sending SMPT server will be on several black lists.
Quote:
I also want to be sure that an email is really send to the provided email address (but not actually delivered).
That requires that the fake server supports that by talking directly to the recipients mail server. Even if he is able to do that it might fail when the source IP is blocked (e.g. when using a dynamic IP adress).
-
I understand from your initial post that you only want to test the mail features. The used mail server settings must be replaced before going live. The final SMTP server will be probably those of the company running the web site (or the SMTP server of their hoster if they did not have their own one) and a corresponding account (at best one created especially for the web service).
Quote:
but I want to make sure no one ever accidentally sends an email to someone who isn't expecting this.
That is a different problem and one of those that can't be achieved by 100 % (besides not supporting mails to be send to addresses entered on the page). It is a dangerous area. Once such a service is abused, the IP address of the sending SMPT server will be on several black lists.
Quote:
I also want to be sure that an email is really send to the provided email address (but not actually delivered).
That requires that the fake server supports that by talking directly to the recipients mail server. Even if he is able to do that it might fail when the source IP is blocked (e.g. when using a dynamic IP adress).
Fake SMTP always did a good job of making sure no email was sent out to the actual recipients. You set it up for your test environment and an email is send to the SMTP server, but the SMTP server simply doesn't send it to the recipient :D At least that's how I think it works (I don't know much about SMTP). That's what Fake SMTP does and it's what Mailtrap promises.
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
-
Fake SMTP always did a good job of making sure no email was sent out to the actual recipients. You set it up for your test environment and an email is send to the SMTP server, but the SMTP server simply doesn't send it to the recipient :D At least that's how I think it works (I don't know much about SMTP). That's what Fake SMTP does and it's what Mailtrap promises.
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Sander Rossel wrote:
You set it up for your test environment and an email is send to the SMTP server, but the SMTP server simply doesn't send it to the recipient
I understand that. But if it is not talking to the recipients SMTP server (and it seems so after having a quick look), you would not even know if the recipient address exists. So all you are testing is the email sending code on your web page (without authentication). If you only have a single recipient address (like with contact forms on web pages), it is better to send and deliver mails to real addresses. From my point of view such a fake server would be only useful for testing the code that sends to multiple recipients like newsletters or the notificaton mails here at CP. But the first case (newsletters to a list of registered users) can be also done without a fake server when using a small test list. A quick introduction what is happening when sending mails:
- A DNS query is initiated for the domain part of the recipients address asking for the MX (Mail eXchange) record
- A connection to the returned IP address is establish on port 25 (SMTP)
- Using the SMTP protocol the mail is passed to the server
To avoid abuse and spamming, SMTP servers use nowadays a lot of checks before accepting a mail. This includes checking of the source IP address to be black listed or to be a dialup (dynamic) IP. So you usually do not use the above direct sending anymore but send the mail to a so called forwarding SMTP server. That is what you setup in your email client software or on a web server. For security and anti spam reasons, these require nowadays secure connections and authentication. The forwarding server will then establish the connection to the recipients SMTP server. If that fails, you will get a notification mail send to the account used for authentication (nowadays) and containing the error response from the recipients server. A fake SMTP server is nothing else than a forwarding SMTP server that simply does not forward (does not connect to the recipients SMTP server or - if a better one - quits the SMTP dialog before pushing the mail content up). Not much to do today at work. So I have plenty of time to write such long posts.
-
Quick non-programming-but-probably-programming-related question :D Does anyone have recommendations for a test SMTP program? I'm running a web service in Azure that sends out emails. The company I'm currently working at does not have an own infrastructure and the application we're building is 100% cloud. There's probably "something" in-house I can use, but I'll be happy if I get that data before my retirement :laugh: In the past I've worked with FakeSMTP – FakeSMTP - Dummy SMTP server for developers[^], but as I understand it that requires a server to run. It would be possible to create one in Azure, but I prefer a SaaS solution. So far I've found Mailtrap.io — Fake smtp testing server. Dummy smtp email testing[^], but I've never worked with it. Any recommendations?
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Personally I use smtp4dev[^] but there are probably lots if you look. Another possible alternative, if you are using the SmtpClient, is to use a pickup folder rather than an smtp server. SmtpDeliveryMethod Enumeration (System.Net.Mail)[^] That way any mail sent though the client is simply written to disc instead for you to inspect at your leisure. However it will involve you having some kind of setting in your code that lets you specify if you are using a pickup folder or an actual smtp server and you'll need to switch between the two for testing\live.
-
Yeah, that's an option I'm sure. But that would require an entire VM to be up and running and maintained for "just" SMTP. A SaaS model has my preference so I never need to worry about any hardware :-) The idea is that I configure that SMTP server and no matter what I mail to whom the SMTP server will simply "swallow" it and my coworkers and I can read the emails from the service's portal. No one will ever be able to "accidentally" send an email to real people who aren't expecting it. Not testers, not newbies, and not me :D
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Well, you could write a small console app with an open listener socket on port 25 and return HTTP 250 OK messages to any connection and then close the connection. Just launch it on any machine and point the email traffic there. See SMTP RFC 821[^] for further details.
if (Object.DividedByZero == true) { Universe.Implode(); }
-
Well, you could write a small console app with an open listener socket on port 25 and return HTTP 250 OK messages to any connection and then close the connection. Just launch it on any machine and point the email traffic there. See SMTP RFC 821[^] for further details.
if (Object.DividedByZero == true) { Universe.Implode(); }
Foothill wrote:
HTTP 250 OK
FTFY Such a simple server should at least wait for a QUIT command and respond before closing the connection. Otherwise there will be a socket error on the sender side when the connection is closed after the first command. But I guess that is not what he wants when inspecting the received mail is required to check if it has been generated as expected.
-
Quick non-programming-but-probably-programming-related question :D Does anyone have recommendations for a test SMTP program? I'm running a web service in Azure that sends out emails. The company I'm currently working at does not have an own infrastructure and the application we're building is 100% cloud. There's probably "something" in-house I can use, but I'll be happy if I get that data before my retirement :laugh: In the past I've worked with FakeSMTP – FakeSMTP - Dummy SMTP server for developers[^], but as I understand it that requires a server to run. It would be possible to create one in Azure, but I prefer a SaaS solution. So far I've found Mailtrap.io — Fake smtp testing server. Dummy smtp email testing[^], but I've never worked with it. Any recommendations?
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Not sure if it will do you, but I use 'SMTP4Dev" for all emails I want to generate but go to a folder instead. I have usedd it for years, and it has served all my (fake) SMTP needs. [GitHub - rnwood/smtp4dev: smtp4dev - the mail server for development](https://github.com/rnwood/smtp4dev)
A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long
-
Quick non-programming-but-probably-programming-related question :D Does anyone have recommendations for a test SMTP program? I'm running a web service in Azure that sends out emails. The company I'm currently working at does not have an own infrastructure and the application we're building is 100% cloud. There's probably "something" in-house I can use, but I'll be happy if I get that data before my retirement :laugh: In the past I've worked with FakeSMTP – FakeSMTP - Dummy SMTP server for developers[^], but as I understand it that requires a server to run. It would be possible to create one in Azure, but I prefer a SaaS solution. So far I've found Mailtrap.io — Fake smtp testing server. Dummy smtp email testing[^], but I've never worked with it. Any recommendations?
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Couple of options, SendGrid do a free Azure account with limited traffic for testing (search the Azure marketplace for Sendgrid free), VM with something like hMailServer or even just set something up elsewhere (e.g. your dev machine) and point the app to it... It's worth pointing out however that you won't be able to run an SMTP server on azure in the long run - not only is it against the license, you won't be able to get appropriate reverse dns set up and the azure IPs are on pretty much every spam list going, so even if you set it up, hardly anyone will be able to receive the mails you send.
C# has already designed away most of the tedium of C++.
-
Well, you could write a small console app with an open listener socket on port 25 and return HTTP 250 OK messages to any connection and then close the connection. Just launch it on any machine and point the email traffic there. See SMTP RFC 821[^] for further details.
if (Object.DividedByZero == true) { Universe.Implode(); }
It's a bit more complicated than that and I don't feel like doing all that work when there are good alternatives :)
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
-
Personally I use smtp4dev[^] but there are probably lots if you look. Another possible alternative, if you are using the SmtpClient, is to use a pickup folder rather than an smtp server. SmtpDeliveryMethod Enumeration (System.Net.Mail)[^] That way any mail sent though the client is simply written to disc instead for you to inspect at your leisure. However it will involve you having some kind of setting in your code that lets you specify if you are using a pickup folder or an actual smtp server and you'll need to switch between the two for testing\live.
F-ES Sitecore wrote:
Also not SaaS by the looks of it, but looks like a nice alternative for Fake SMTP.
F-ES Sitecore wrote:
use a pickup folder rather than an smtp server
F-ES Sitecore wrote:
it will involve you having some kind of setting in your code
Exactly, and being lazy as I am I don't want that ;p
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
-
Couple of options, SendGrid do a free Azure account with limited traffic for testing (search the Azure marketplace for Sendgrid free), VM with something like hMailServer or even just set something up elsewhere (e.g. your dev machine) and point the app to it... It's worth pointing out however that you won't be able to run an SMTP server on azure in the long run - not only is it against the license, you won't be able to get appropriate reverse dns set up and the azure IPs are on pretty much every spam list going, so even if you set it up, hardly anyone will be able to receive the mails you send.
C# has already designed away most of the tedium of C++.
Seems like SendGrid it is. Apparently, someone set it up before me :) :thumbsup:
RichardGrimmer wrote:
you won't be able to run an SMTP server on azure in the long run - not only is it against the license
What license? Can't I just spin up a VM and install some SMTP software?
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
-
Seems like SendGrid it is. Apparently, someone set it up before me :) :thumbsup:
RichardGrimmer wrote:
you won't be able to run an SMTP server on azure in the long run - not only is it against the license
What license? Can't I just spin up a VM and install some SMTP software?
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
You can, but you end up on shaky ground, and they reserve the right to remove it without notice or compensation etc...
C# has already designed away most of the tedium of C++.