Is it possible to send an email programmatically without using any actual email account

Yes, it is absolutely possible to do that. From a relatively low-level perspective, you need to:

  1. Resolve the MX (mail-exchanger) server for the e-mail account you want to send to.
  2. Open a socket to the MX server.
  3. Send the appropriate SMTP commands to cause the e-mail message to be delivered to your recipient account. You essentially have the freedom to set the "from" address to be any arbitrary thing you want.

SMTP is a very simple/human-friendly protocol, so it's not a massive effort to do all of that by hand. At the same time, there are prebuilt libraries that will handle all of that for you (except possibly the resolution of the recipient's MX server).

Note that emails sent this way are more likely to be filtered out as spam (generally because the sender's IP/hostname is not going to match whatever domain you put on the outgoing e-mail address you decide to use).

Also note that since you can set the "from" address to anything, you have the option of asking the user if they want to provide their actual contact address, and if they do you can make that the "from" address so that you can actually get back in touch with them if necessary.


You don't need to use email at all. Consider using an error reporting service like sentry or airbrake.

These services have clients that you embed in your program; which automatically log your errors, including any debugging information/stacktrace; and notify you by email when your application reports a problem.

Usually you integrate the app's API into your own error handling mechanism. At the point of an error, the client will capture your debugging information, you can popup a modal asking user for information like "what were you doing when this error happened?", save that as part of your error response that is sent back to the service.

Since the app works over HTTP, you don't need any special ports to be open. It is easier and more helpful than having users send you emails with "it doesn't work!!", and you don't have to deal with email sending headaches.


I recently wrote an article on this: Sending email with C#

You basically have two choices, either you send it using an SMTP-client, this means that you have to have a SMTP-server and be able to connect to port 25 (if you're not using an external SMTP, then you have to manage that by yourself). Or you can use an external email provider, such as:

  • AlphaMail
  • SendGrid
  • Mandrill

If you're using AlphaMail you can send emails in the following way:

IEmailService emailService = new AlphaMailEmailService()
    .SetServiceUrl("http://api.amail.io/v1/")
    .SetApiToken("YOUR-ACCOUNT-API-TOKEN-HERE");

var person = new Person()
{
    Id = 1234,
    UserName = "jdoe78",
    FirstName = "John",
    LastName = "Doe",
    DateOfBirth = 1978
};

var response = emailService.Queue(new EmailMessagePayload()
    .SetProjectId(12345) // ID of AlphaMail project (determines options, template, etc)
    .SetSender(new EmailContact("[email protected]", "[email protected]"))
    .SetReceiver(new EmailContact("Joe E. Receiver", "[email protected]"))
    .SetBodyObject(person) // Any serializable object
);

Another thing that differs from just building HTML and sending it with an SMTP-client is that with AlphaMail you have the ability to edit your emails outside your code directly in a GUI. You can also easily create highly dynamic templates using AlphaMail's templating language Comlang.

<html>
    <body>
        <b>Name:</b> <# payload.FirstName " " payload.LastName #><br>
        <b>Date of Birth:</b> <# payload.DateOfBirth #><br>

        <# if (payload.Id != null) { #>
            <a href="http://company.com/sign-up">Sign Up Free!</a>
        <# } else { #>
            <a href="http://company.com/login?username=<# urlencode(payload.UserName) #>">Sign In</a>
        <# } #>
    </body>
</html>