Is there a way to send emails from asp.net without using SMTP?

Thread Starter

Shafty

Joined Apr 25, 2023
131
That depends on what you mean by “without”.

Describing the application will make a useful answer possible.
Thanks for the reply Ya’akov. I am building a web App using asp.net which needs to send emails for member registration to send the verification code/links. But unfortunately, in my office (in the high levels, SMTP Ports are disabled)
 

Ya’akov

Joined Jan 27, 2019
8,164
In that case you need to either talk to a local smtpd (that is, on your network) that is allowed to use port 25 outside for delivery, or use submission, port 587 which is meant to be left open for this purpose.

You will not be able to talk directly to the server that delivers email to the registering user unless that server is also on your local network.
 

Thread Starter

Shafty

Joined Apr 25, 2023
131
In that case you need to either talk to a local smtpd (that is, on your network) that is allowed to use port 25 outside for delivery, or use submission, port 587 which is meant to be left open for this purpose.

You will not be able to talk directly to the server that delivers email to the registering user unless that server is also on your local network.
We are just trying to push the boundaries as much as possible from our department side. You know. If we go to the IT department, we have to go formally from creating indents to multiple approvals. Imagine if there is a way to send and receive emails without those hassles!!!
 

strantor

Joined Oct 3, 2010
6,690
If SMTP is disabled then I assume your organization is using office 365 mail? If so, check out MS Graph API. Using Graph will require IT to grant your app permission to access the API but one you have that it is pretty easy.
 

Thread Starter

Shafty

Joined Apr 25, 2023
131
If SMTP is disabled then I assume your organization is using office 365 mail? If so, check out MS Graph API. Using Graph will require IT to grant your app permission to access the API but one you have that it is pretty easy.
Thanks for the reply strantor. You know how to find the office 365 mail address just by exploring the office account signed into the app like Ms Word? or Ms Access?
I wonder how the apps are active without a microsoft account login?
 

strantor

Joined Oct 3, 2010
6,690
Thanks for the reply strantor. You know how to find the office 365 mail address just by exploring the office account signed into the app like Ms Word? or Ms Access?
I wonder how the apps are active without a microsoft account login?
Go into account settings and see what server the account is accessing. If it's "mail.myorganization.com" or similar then your email server is probably on premises. But if it's "outlook.office365.com" or similar then it's an O365 account.

If your server is on premises (not O365) and the admin has disabled SMTP then I am curious what is being used instead.
 

Thread Starter

Shafty

Joined Apr 25, 2023
131
Go into account settings and see what server the account is accessing. If it's "mail.myorganization.com" or similar then your email server is probably on premises. But if it's "outlook.office365.com" or similar then it's an O365 account.

If your server is on premises (not O365) and the admin has disabled SMTP then I am curious what is being used instead.
I have to go office tomorrow to reply on the same. Thanks Strantor.
 

Ya’akov

Joined Jan 27, 2019
8,164
You can’t send email without something using SMTP. You can use a service that accepts email on an alternative port, like submission that I mentioned earlier. You can use an API call that sends the mail for you. You can pay a bulk mail service and use their SMTP server.

But, you didn’t ask “how can I send mail without contacting an SMTP server directly”.

Forget it, pretend I never said anything—I’m going to.
 

Ya’akov

Joined Jan 27, 2019
8,164
Go into account settings and see what server the account is accessing. If it's "mail.myorganization.com" or similar then your email server is probably on premises. But if it's "outlook.office365.com" or similar then it's an O365 account.

If your server is on premises (not O365) and the admin has disabled SMTP then I am curious what is being used instead.
It seems most likely that the only thing disable is the use of port 25 off the LAN.
 

strantor

Joined Oct 3, 2010
6,690
It seems most likely that the only thing disable is the use of port 25 off the LAN.
That's possible but given the wording of the 2nd hand information in the OP I suspect what is disabled is SMTP basic authentication (passing user name and password).

I have had to write, re-write, and re-re-write the email sending script I use at work over the past couple of years, as this situation has evolved:

https://learn.microsoft.com/en-us/e...ation-of-basic-authentication-exchange-online

Originally i was using Gmail accounts for sending automated emails from production lines to supervisors. 12 lines in different locations. All the sudden one day they stopped working. Some research indicated they had disabled this outdated password authentication method but I could re-enable it by going into each account and ticking the option for "use less secure apps." So I did that, and it worked, for a few months. Then they all quit working again and the "less secure apps" option no longer existed.

I asked IT to create me a dozen accounts on the organization domain and they did, and with just a few code tweaks they worked, for a few months. Then they all quit working again.

The article I cited is dated 8/30/23 but actually they started what I would call "rolling blackouts" way earlier than that, reaching into customers' systems ahead of schedule and disabling things without permission or even notification, and we got hit early. I started writing a script to support OAUTH2 ("modern authentication," token based) but could not get it to work. Then IT received sufficient pressure on-high, to dig in and find that they could roll back the changes, re-enable basic authentication. So the script worked for another few months. Then support for basic authentication was totally removed and they could not restore it (way before 8/30/23).

So I got the OAUTH2 script to work finally. Back in business for another few months. Then my organization decided that hosting an email server on premises was not a justifiable use of resources so they migrated all the accounts to Office 365.

My OAUTH2 script no longer worked after the emails were hosted by O365. I don't know why, it should have. Actually the authentication WAS working but after receiving the token I could not do anything; send or receive, I don't remember what issue was cited. But I could access Microsoft APIs so I just did that instead. I could get my token and then use it with Graph API to navigate an inbox, send, receive.

So, new script based around Graph API and I actually like it better. Graph email objects are structured better and make much more sense.
 

strantor

Joined Oct 3, 2010
6,690
Yes this was an option I evaluated and it seemed like a very straightforward service to use, and if I only needed to send email I definitely would have used used it. If you only need to send, then it may be your easiest option. But I also needed to receive, and parse out commands from the replies.
 
Top