Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Fake SMTP

Fake SMTP

Scheduled Pinned Locked Moved The Lounge
csharpsysadmincloudjavascriptquestion
19 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rage

    I am not even sure that what I write makes sense, but can't you install a server on a virtual machine, and then run the SMTP service on it ?

    Do not escape reality : improve reality !

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #4

    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

    R F 2 Replies Last reply
    0
    • Sander RosselS Sander Rossel

      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

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #5

      Sander Rossel wrote:

      not me

      :laugh:

      Do not escape reality : improve reality !

      1 Reply Last reply
      0
      • J Jochen Arndt

        Can't you just use one of your mail accounts for testing by using the SMTP server of that account and passing the credentials? Because you will send real mails, this will limit the testing to specific recipient addresses (yours and maybe of some colleagues that are informed about the test mails) but is usually sufficient for testing.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #6

        that's easiest, can even use gmail smtp on a brand new account so you don't have to code the credentials of a real account. It'll only vomit if you try to send too many messages or too soon together, add some delay.

        1 Reply Last reply
        0
        • J Jochen Arndt

          Can't you just use one of your mail accounts for testing by using the SMTP server of that account and passing the credentials? Because you will send real mails, this will limit the testing to specific recipient addresses (yours and maybe of some colleagues that are informed about the test mails) but is usually sufficient for testing.

          Sander RosselS Offline
          Sander RosselS Offline
          Sander Rossel
          wrote on last edited by
          #7

          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

          J 1 Reply Last reply
          0
          • Sander RosselS Sander Rossel

            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

            J Offline
            J Offline
            Jochen Arndt
            wrote on last edited by
            #8

            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).

            Sander RosselS 1 Reply Last reply
            0
            • J Jochen Arndt

              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).

              Sander RosselS Offline
              Sander RosselS Offline
              Sander Rossel
              wrote on last edited by
              #9

              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

              J 1 Reply Last reply
              0
              • Sander RosselS Sander Rossel

                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

                J Offline
                J Offline
                Jochen Arndt
                wrote on last edited by
                #10

                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.

                1 Reply Last reply
                0
                • Sander RosselS Sander Rossel

                  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

                  F Offline
                  F Offline
                  F ES Sitecore
                  wrote on last edited by
                  #11

                  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.

                  Sander RosselS 1 Reply Last reply
                  0
                  • Sander RosselS Sander Rossel

                    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

                    F Offline
                    F Offline
                    Foothill
                    wrote on last edited by
                    #12

                    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(); }

                    J Sander RosselS 2 Replies Last reply
                    0
                    • F Foothill

                      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(); }

                      J Offline
                      J Offline
                      Jochen Arndt
                      wrote on last edited by
                      #13

                      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.

                      1 Reply Last reply
                      0
                      • Sander RosselS Sander Rossel

                        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

                        S Offline
                        S Offline
                        stoneyowl2
                        wrote on last edited by
                        #14

                        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

                        1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          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

                          R Offline
                          R Offline
                          RichardGrimmer
                          wrote on last edited by
                          #15

                          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++.

                          Sander RosselS 1 Reply Last reply
                          0
                          • F Foothill

                            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(); }

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #16

                            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

                            1 Reply Last reply
                            0
                            • F F ES Sitecore

                              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.

                              Sander RosselS Offline
                              Sander RosselS Offline
                              Sander Rossel
                              wrote on last edited by
                              #17

                              F-ES Sitecore wrote:

                              Personally I use smtp4dev[^]

                              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

                              1 Reply Last reply
                              0
                              • R RichardGrimmer

                                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++.

                                Sander RosselS Offline
                                Sander RosselS Offline
                                Sander Rossel
                                wrote on last edited by
                                #18

                                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

                                R 1 Reply Last reply
                                0
                                • Sander RosselS Sander Rossel

                                  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

                                  R Offline
                                  R Offline
                                  RichardGrimmer
                                  wrote on last edited by
                                  #19

                                  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++.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups