c# - Email Support section with the users address as "From address" -


i need implement “email support” section in our application. email “to” address admin@mydomain.com” , address email address of end user.(the end users email address may on same domain or domain user@mydomain.com or user@gmail.com).

in application authenticated email using admins account details (username , password)

system.net.networkcredential("admin@mydomain.com", adminpassword); 

also using host address “mail.mydomain.com” issue getting following error:

“mailbox unavailable. server response was: address must match authenticated address” error message.

is possible send email correct sender email address(users address)

my code sample is

message.to.add(“admin@mydomain.com”); message.from = new mailaddress(“test@gmail.com”); message.isbodyhtml = true; message.bodyencoding = encoding.utf8; var smtp = new smtpclient("mail.mydomain.com"); smtp.credentials = new system.net.networkcredential(admin@mydomain.com, adminpassword); smtp.enablessl = false; object usrtkn = message; smtp.send(message); 

in general address shouldn't user themselves, should internal system address. because the user isn't sending email, application is. in email can specify user sent (and email address is). can perhaps specify user's email address in the replyto field of message.

but message you're getting smtp server pretty says all. if message "from" user smtp server refuses because it's sensitive authentication , origination of emails. smtp server (to smtp server imagine) looks you're trying spoof messages.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -