Sending Email through IIS for ASP.NET MVC - c#

In asp.net mvc, how can I send email without external SMTP server? Does IIS can help me with this job?
Normally, I can use SmtpClient to send email, but I have to config an external server such as 'smtp.gmail.com' to help me send the mail, also I have to set the credentials for it which we may need to create a new account for our app in Gmail, that's what we want to avoid. What we want to achieve is just send an email to user, and with that email user can confirm their information.
So, any simple method to do this?

you cant sent an email without an smtp Server. because the smtp Server is the object in the chain that SENDS the email :) and the IIS doesnt implement smtp Server functionality
SMTPClient -> SMTPServer Sender -> SMTP Server Reciever -> POP -> Email CLient
There are several relay smtp Server without smtp-auth out there but i recommend you to avoid the use of them because else YOU will be marked as spam pretty sure.

Related

Is it possible to send emails from any type of email using common smtp host?

i used Simple Mail Transfer Protocol gmail host to send emails from gmail it works fine.but when try to send email from yahoo or outlook it doesn't work. Is it Possible to send emails from all type of mails like yahoo,outlook etc in Simple Mail Transfer Protocol using common Simple Mail Transfer Protocol host in c# ?
Yes, C# has built in support for sending emails using any standard SMTP server
If your question is more about why gmail and outlook didn't work when you tried you'll need to include more detail such as error messages. As long as gmail/outlook do provide an accessible and protocol compliant SMTP service on your country/to your location, and you're using it in accordance with their instructions/you're properly authenticating with an account that has access, and they aren't classifying your mail as spam then the mail should be sent as with any other SMTP service
https://support.google.com/a/answer/176600?hl=en
https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040

C# custom mail server: receive email through socket on local machine

I'm writing unit testing for email validation.
I'm trying to write a very simple POP3 email listener (using sockets) so the email can be sent to my local machine using something like test#hostnameofmymachine.
I tried to do something like this: https://msdn.microsoft.com/en-us/library/kb5kfec7%28v=vs.110%29.aspx
But I don't know on which port the email will be sent so I can't create a socket unless I know which port to listen to.
How can the SMTP server (which sends the message) can know on which port to send the email? (IMAP 143? 993?) (POP3 110? 995?) So I don't know on which port I must listen to.
How can the SMTP know whether the receiver is POP3 or IMAP? How can it know whether SSL is supported?
I'm quite sure I'm missing some important information regarding email protocol.
POP3 and IMAP do not receive email, they only allow access to stored emails.
You need to write an SMTP server, not a POP3 server.
I recommend you to use this repository, it contains in itself most of the services you may need and it is easy to configure.
In our case we use the services:
Postfix with SMTP.
Dovecot for POP3.
SpamAssassin with custom rules.
OpenDKIM
OpenDMARC
LetsEncrypt and self-signed certificates
Persistent data and state
CI/CD
Extension Delimiters (you+extension#example.com go to you#example.com)
Docker Mail Server
https://github.com/docker-mailserver/docker-mailserver

How to Detect Email Bounces with IIS 6 with C#

Just as the question says.
I am using IIS 6 to send emails out from my Windows Server with C#. I want to detect bounces with C# from the SMTP email server. Right now, all the bounces get sent to a Gmail account. I could just check and parse each email in that account, but I was wondering if there is any easier way like hooking up a windows service or something to the IIS 6 SMTP server.
Help?
Thanks!
I know little about the IIS6 SMTP server, but based on what I know about SMTP in general, I doubt you're going to have much luck. Your message to joe#foo.com gets forwarded from server to server until it ends up at the foo.com SMTP server, which then responds to the reply-to address that the "joe" mailbox doesn't exist. That server may have no direct contact with your SMTP server at all.
As a result, there's no opportunity for the IIS6 SMTP server to receive any information about the bounced message. I think your existing idea of polling the inbox for the reply-to address is probably going to be your best bet.

Send an email using exchange server ONLY

I need to send an email in my C# project using my companies Exchange Server.
Because someone sent out thousands of Emails from my company using a self hosted server, any attempts to not use the company Exchange Server to send the email will be squished.
I imagine I am going to need to get an Active Directory user created to do this... but what code to use? How to do the sending?
You can send email through Exchange using SMTP with .Net's SmtpClient class.
You will need a login for the server.
You could use the System.Net.Mail classes to send the email via SMTP if that is enabled on your SMTP server. Alternatively you could use the webdav protocol to send the email via HttpRequests and HttpResponses. An example showing how to do this can be found here.

Send mail from C# application not really working?

I have an email application where a user can fill out a form and the info get's mail to the form admin. I have the correct server and email credentials being set and i do not get any errors when the mail is sent. The To and From addresses are the same (admin#thedomain.com) It is like the mail is somewhere in limbo. I know the email account works, because I send mail to it from outlook. Any thoughts?
update:
Regarding code, I have created an abstraction to the System.Net.Mail.SmtpClient class. I can set another server and the code works. The server that does work is within my host’s network. The server that does not work is outside of the network. Strange thing is, like I said, I can setup the account in OutLook and I can send / receive mail fine. I’ll have to check with my vendor to see if the mail is indeed getting to their server.
My guess is permissions. Can your app send an email to your address?
I believe .net's system.web.mail sends email via relay. You need to check with your email admin to determine if your IP address is allowed on the server to relay mail.
It turned out to be a DNS issue with my hosting company. I could send mail via outlook becuase I was direclty connecting to the mail servers. The MX records were screwed up. Thanks to all who looked

Categories

Resources