Question : Email an attachment in C# Windows application

We are developing a .Net Windows application in C# for commercial distribution.

Objective
I want to add a function to allow the user to email a file to any email recipient from within the application without needing an email client on their PC, just an internet connection. The email they send needs to appear that it has come from them (i.e. their email address is in the FROM/REPLYTO field) so that the recipient can identify where the email has come from and they can reply to it.

Current Approach
I was intending to use the MailMessage class in System.Net.Mail, but it requires an SMTP server to send the email. The problem with that is, i dont want the user to have to configure anything to send emails from our application - i want it set up by us. In other words, i want to define what SMTP server to send the email from and hardcode it in the application.

I have tried to use Gmail as the SMTP server, however one major drawback - Gmail automatically rewrites the "From" line of any e-mail you send via their SMTP gateway to your Gmail address, so when we tested this, even though in the MailMessage code we set the FROM property to [email protected], when the email was received, the From field displayed [email protected]

Questions
  • If this software is going to be distributed to many users in different network environments, is this method the best to use? If so, is there a free/public SMTP server i can use for our application to achieve this that will allow the end-user to define the FROM and REPLYTO fields?

  • Is there any other method i could use to achieve my original objective?


Thanks

Answer : Email an attachment in C# Windows application

I only have version 12 here.

Try searching the registry for "Agent Directory List" that might do it.
Random Solutions  
 
programming4us programming4us