Click here to Skip to main content
15,888,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send email from my mail server to client,

I use the code bellow:

The web.config:
C#
<system.net>
    <mailSettings>
      <smtp>
        <network host="mail.mydomain.com" userName="mymail@mydomain.com" password="password" />
      </smtp>
    </mailSettings>
  </system.net>


send_mail.aspx :
C#
MailMessage msg = new MailMessage("senderMail", "recieverMail");
msg.body = "body text";
msg.subject = "msg subject";

SmtpClient smtp = new SmtpClient();
smtp.Send(msg);


This was working till 4 days ago! With any senderMail !

Now I've figured that I should just use the email that is authenticated in my mail server, such as mymail@mydomain.com. for other sender addresses I get this errer message:

C#
...The server response was: From domain must match authenticated domain... 


Is there any way to send mails with any sender addresses again !

Thanks in advance.
Posted
Comments
AnvilRanger 13-Mar-14 13:07pm    
Is this a mail server you have full control over or is it your hosting company's server?
ZurdoDev 13-Mar-14 13:14pm    
You'll have to get your SMTP admin to fix it. It isn't a code question.

This has nothing to do with your code and there is nothing you can do about it, other than changing the server you're using to send mail.

It's telling you, point blank, that the server REQUIRES the sender address to match the account that was used to login to the SMTP server. You cannot get around that.

Well, unless you change the SMTP server you're using to one that does allow it. The problem is that most public servers will not allow you to do that because of spam.
 
Share this answer
 
Quote:
When sending email using WebSecureStores SMTP server the from address must match the authenticated address in order to send. Some devices and email software will have the site or device authenticate with a email configured for the site for example admin@mydomain.com. Then the logged in user on the site or device with email user@mydomain.com that has privileged level to send email will use the software to send an email. When they do this the SMTP header will show the authenticated user as admin@mydomain.com and the sender as user@mydomain.com this will cause an error "rsp: 550 From address must match authenticated address" and the email will not be delivered. If you authenticate on the SMTP server with the user named "admin@mydomain.com" then you must also send the email using "admin@mydomain.com".


-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900