c# MailMessage: Send mail using default email account -


i'm sending emails winforms app using mailmessage functionality.

i compile email, save disk , default mail client open mail user verify settings before hitting send.

i want set 'from' of email automatically default email account set in mail client. how can that?

var mailmessage = new mailmessage(); mailmessage.from = new mailaddress(fromemailaccount); mailmessage.to.add(new mailaddress("recipient@work.com")); mailmessage.subject = "mail subject"; mailmessage.body = "mail body"; 

if leave fromemailaccount blank error, , if set 'test@test.com' email not send local account not have permissions send via unknown account.

get user information os (if windows 8, 10) them set user email, see question: get user information in windows 8?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -