How to get SMTP details automatically in VB.NET li

2019-07-26 22:45发布

问题:

I have made a VB.NET application. I have read I tutorials that how to use SMTP to send emails from VB.NET, and finally I got one working.

But I have an issue with it, I don't want to bother the user to input all his details like, SMTP server name and all those stuffs.

I just want that a user input their Usename and Password and all other necessary details gets available for the application. Same like thunderbird, as when I enter my Usename and Password in Mozilla thunderbird it automatically get all the other required data and configures my email account.

Now what I want to accomplish is that, a user should fill in their details i.e. Usename and Password & the email using their Usename and Password should be sent to the email specified in the program.

To explain more about the kind of my project is, when an error occurs I want the user to take a screenshot of it and email me it using this method. So that I can look into the bug.

回答1:

There is no automatic way of doing this. Each email setup is different and there is no automated configuration specification.

Thunderbird has a built in database that it's developers built and maintain to offer this functionality. See: https://support.mozillamessaging.com/en-US/kb/isp-database

You could do the same using the @domain.tld to enable you to match the users email provider with your database.

Microsoft Exchange does offer an automatic configuration endpoint, but I don't think it would prove useful to you as it isn't guaranteed to include SMTP information.