default for MailMessage from property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way of getting the default email address for the logged in user?
I am creating a MailMessage and need a valid from address in order to send
an email in my app with SmtpMail.Send.
 
James said:
Is there a way of getting the default email address for the logged in user?
I am creating a MailMessage and need a valid from address in order to send
an email in my app with SmtpMail.Send.

Where do you expect to find an email address for a logged in user? Your
windows account doesn't contain an email address. So you're looking at
the users' email program. That could be outlook (express) or any of the
countless other email programs out there. So unless you demand an
environment variable to be set for your program I don't see a sure fire
way to get the address. Which in the end I don't regret since that makes
it that much harder for emailaddress harvesting worms etc.

You could always enter your own address as from, or fabricate one..
Valid only means valid format like (e-mail address removed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top