Sending Mail over proxy server - c#

I am using a LAN network, which uses a proxy server. In C#, I am trying to develop an application through which I can send E-mails. But from my network, I can't send mail due to this proxy issue. From any other network, not dependent on proxy server, there is no problem to send mail.
I typed in command prompt, telnet smtp.gmail.com 25
and it displays it can't connect to 'smtp.gmail.com'

It sounds like your proxy is explicitly denying the gmail.com domain (if its a corporate network then many do). Can you reach gmail.com in your browser (if you can't this may put up a nasty looking alert from your systems guys).
There are a couple of ways round this:
Get smtp.gmail.com, or port 25 to smtp.gmail.com, unblocked on the proxy.
Get an smtp relay put in place instaed of using smtp from gmail. There's some info on this here.
Either way, time to go and be nice to your sys admins!

Related

Configure SMTP Server to send mail

I have deployed a website (ASP.Net/C#) on my windows server 2012 R2 (it's a VPS and I installed IIS and SMTP), and everything works fine except one thing: I CANNOT send mail through my website!
I searched and tried everything but it still doesn't work! When I was debugging my application on local, it worked fine. Now I know I have to change my settings to send mail but I don't know what I should indicate
I'm sending my emails from a mail address that use pop3 server "relay.skynet.be" (this is the server I used when I was debugging and it worked) but when I do it on the website I got an error... So I changed it to the name of the server where my VPS is hosted (OVH) and it still doesn't work... I also changed the different credentials (in my code or in the SMTP in IIS) but the result is the same...
So I'm asking these questions:
In my code (C#), what should I indicate?? Which server should I indicate? And which credentials?
On Windows Server, in the SMTP settings in IIS, what should I choose? Should I indicate the e-mail address with which I send my emails? Do I have to check the "Use localhost" for the SMTP server to use or indicate the server of my mail address (relay.skynet.be) or the one from OVH? And for the credentials, what do I have to check? "Not required", "Windows" or "Specify Credentials" (with my mail address credentials?)
I have a strong feeling that you are simply missing the infrastructure - specifically, you are missing an SMTP server. SMTP server is responsible for delivering (or forwarding) your email.
Neither POP3 nor IMAP protocols are used for sending emails.
If this is the case, I suggest you try using hotmail or gmail mail account. You can find the settings for both here, respectively:
http://www.serversmtp.com/en/smtp-hotmail
http://www.serversmtp.com/en/smtp-gmail-configuration
Hope this helps.

Force SMTP server to only send mail via TLS

I'm developing an ASP.NET MVC application that needs to transmit sensitive information via email. I'm aware of using S/MIME to encrypt the email contents end-to-end, but I cannot use it for various reasons. I also realize, however, that the emails would be sent in plain-text from the web host's SMTP server to the destination email servers, opening up a serious man-in-the-middle vulnerability. Therefore, I need to ensure that the outgoing SMTP server will transmit a message ONLY IF it can establish a TLS/SSL connection with the destination mail server.
I've been searching for a while and can't even figure out where in the process that decision is made. Most answers address enforcing TLS between the application and the SMTP server, which I've already solved. Can anyone shed some light on this? Thanks.
What you are trying to do is not possible. Once you've submitted the mail to the mail server you've lost control over it. There is no way to instruct the server (and all following server in the path) to only deliver the mail with TLS.

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.

Setting up a SMTP mail server

Our e-commerce site requires the sending of email
Currently, for some odd reason, the server that is being used to do this is the database server... which clearly isn't ideal (i've just taken over here)
My idea is this -
to write a windows service that checks for new mails that need sending (these are all in a sql db) and then process the mails seperately...
I want to use a seperate mail server, to keep this efficient..
Has anyone had any experience of this?
Would it be sensible to (for example) set up a lightweight debian (or other distro) machine, with exim on?
Would i be able to use that as the host ip address when specifying my smtp server to send email?
I'm going to be using C#....
I've done this quite a bit, and sometimes I've used a windows server running the SMTP service, other times we've used a third party. In either case you set the host of the mail server in the configuration file and your application can pick it up and continue working.
A nice thing about using a third party service, is that you should have less concern about being black listed.
We did something very similar. We used the IIS SMTP server and wrote code in C# to pump messages directly into its pickup directory using SmtpDeliveryMethod.PickupDirectoryFromIis. systemnetmail.com has some sample code that may help you.
One thing to be careful of is race conditions in the database, especially if you are sending messages with more than one thread (which we were doing). We implemented a queue in the database and used the UPDLOCK and READPAST hints in SQL Server for maximum performance. I think we got it up to over 10,000 emails a minute this way.
You can use the Windows SMTP server wich you can access and use from your web or console application using the CDOSYS or CDO object. You can use this link about configuring the SMTP server on Windows 2003

Categories

Resources