Click here to Skip to main content
15,860,844 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi experts,
i have a quesion plz help me god bless you every one
i want send email from mail.server.ir ,when i send email with this config with gmail it works perfect:
XML
<system.net>
 <mailSettings>           
   <smtp deliveryMethod="Network" from="test@gmail.com">
                <network
                    host="smtp.gmail.com"
                    port="587"
                    defaultCredentials="false"
                    userName="test@gmail.com"
                    password="123456" />
     </smtp>

   </mailSettings>
</system.net>

XML
<appSettings>
        <!-- Email -->
        <add key="SmtpClientEnableSsl" value="1"/>
       
        <!-- /Email -->
        <!-- Businesses -->
        <add key="ActivateUserAfterRegistration" value="0"/>
        <!-- /Businesses -->
    </appSettings>


but when i want change this config to send email from my company server(server.ir):

XML
<system.net>
        <mailSettings>
            <smtp deliveryMethod="Network" from="no-reply@server.ir">
                <network
                    defaultCredentials="false"
                    host="mail.server.ir"
                    port="25"
                    userName="no-reply@server.ir"

                    password="123456"/>
            </smtp>
        </mailSettings>
    </system.net>
    <appSettings>
        <!-- Email -->
        <add key="SmtpClientEnableSsl" value="0"/>
        <!-- /Email -->
        <!-- Businesses -->
        <add key="ActivateUserAfterRegistration" value="0"/>
        <!-- /Businesses -->
    </appSettings>



error occurs
i must change this config help me how can i set these config.

Thanks in advance for an answer.
Posted
Updated 18-Dec-11 23:53pm
v4
Comments
_Tushar Patil 19-Dec-11 4:32am    
Post Error details....?
Uday P.Singh 19-Dec-11 4:56am    
what is the error message?
girish sp 19-Dec-11 6:13am    
could you post your code behind?

How about using
HTML
<add key="SmtpClientEnableSsl" value="1" />


I wanted to post it as comment but it had tags and automatically was removed.

[After you comment]
These people had the same problem as you :

http://stackoverflow.com/questions/777607/the-remote-certificate-is-invalid-according-to-the-validation-procedure-ple


http://stackoverflow.com/questions/7856475/the-remote-certificate-is-invalid-according-to-the-validation-procedure

http://blog.jameshiggs.com/2008/05/01/c-how-to-accept-an-invalid-ssl-certificate-programmatically/
 
Share this answer
 
v2
Comments
zinajoonjooni 19-Dec-11 5:47am    
thanks a lot for your answer,
im sorry,i do it.
when i set SmtpClientEnableSsl 1, i get another error:

{"The remote certificate is invalid according to the validation procedure."}
Amir Mahfoozi 19-Dec-11 6:07am    
I have updated the solution.
zinajoonjooni 19-Dec-11 7:38am    
dear Mahfoozi
they were very useful for me and got me new information but it was not my problem.
i must did it: <pre>defaultCredentials="false"</pre> and <pre><add key="SmtpClientEnableSsl" value="0"/></pre>
and in my mailmessage class i wrote it:

<pre lang="cs">oSmtpClient = new System.Net.Mail.SmtpClient();

if (WebControls.Utilities.GetValue("SmtpClientEnableSsl", "0") == "0")
{
oSmtpClient.EnableSsl = false;
}
else
{
oSmtpClient.EnableSsl = true;
}</pre>

and publish site
with this situation it is correct.
thanks a lot for you answer.
Amir Mahfoozi 19-Dec-11 7:46am    
Thank you :)
Hi,

Just you make :

HTML
defaultCredentials="true" 
 
Share this answer
 
default
defaultCredentials="true"
Credentials="true"
 
Share this answer
 
HI Frnd,

i got same problem and i hosted my site on godaddy VDS(virtual dedicated server).

Please ask your server provider for Email -Relay Address and use that address as host attribute value using that you can sent your Email From your server.

Please let me know it is helpful to you.

and also past the Error so i have better idea about your problem
 
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