email configurations using Gmail smtp server

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
5/16/2011 3:11:17 AM
Gravatar
Total Posts 4

email configurations using Gmail smtp server

 

Hi,

I red you're article how to configure the site settings in order to send emails using mojoportal.
in the web.config file I have used those settings:


<appSettings file="user.config">
    <add key="SMTPServer" value="smtp.gmail.com" />
    <add key="SMTPRequiresAuthentication" value="true" />
    <add key="SMTPPort" value="587" />
    <add key="SMTPUser" value="myUserName@gmail.com" />
    <add key="SMTPPassword" value="myUserPassWord" />
<add key="SMTPUseSsl" value="true" />

and this are my system.net settings
<system.net>
    <!--moran 15/05/11 11:00-->
    <mailSettings>
      <smtp from="myUserName@gmail.com">
        <network host="smtp.gmail.com" port="587" password="myUserPassWord" userName="myUserName@gmail.com"/>
      </smtp>
    </mailSettings>
  </system.net>

I have configured the site email address as the same email address(from field), and still I get this error message:
 

2011-05-15 20:33:55,022 ERROR mojoPortal.Net.Email - error sending email to useremail@gmail.com from useremail@gmail.com, will retry
2011-05-15 20:34:01,209 ERROR mojoPortal.Net.Email - all retries failed sending email to useremail@gmail.com from useremail@gmail.com, message was: dhjkdshdkf<br />customeremail<br /><br /><p>lkjflksjhflkshdfjlshf</p><br /><br />HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24<br />REMOTE_HOST: IP Address<br />REMOTE_ADDR: IP Address<br />LOCAL_ADDR: 82.80.209.2<br />
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout)
   at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)
   at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
   at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
   at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
   at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
   at System.Net.Mail.SmtpClient.GetConnection()
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   --- End of inner exception stack trace ---
   at System.Net.Mail.SmtpClient.Send(MailMessage message)
   at mojoPortal.Net.Email.Send(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority, String[] attachmentPaths, String[] attachmentNames)

I have changed some of the private data deliberately. 

I see in the error log that for some reason the application still wants to use the internal server Address in order to send emails.

5/17/2011 7:08:02 AM
Gravatar
Total Posts 18439

Re: email configurations using Gmail smtp server

If a user.config file exists in the root and if the settings (from <appSettings) are also present there it will use those instead of what you have in Web.config.

Hope that helps,

Joe

5/17/2011 8:37:34 AM
Gravatar
Total Posts 4

Re: email configurations using Gmail smtp server

hi joe

thanks for your help, I am still getting those annoying error messages. can it be something with my hosted server? is there something i can do in order to open port 25?

best regards

Moran

5/17/2011 8:45:53 AM
Gravatar
Total Posts 18439

Re: email configurations using Gmail smtp server

If you configure it for a different port than it should not be trying to use port 25, therefore it seems it is not using the settings you think it is using.

1. Did you check user.config as I mentioned?

2. Possibly you have this setting somewhere:

<add key="EnableSiteSettingsSmtpSettings" value="true"/>

in which case it will not use settings from web.config, but instead will use settings that are managed from Administration > Site Settings

Hope that helps,

Joe

 

5/18/2011 3:05:17 AM
Gravatar
Total Posts 4

Re: email configurations using Gmail smtp server

hi joe

thanks for your help, I think that was the problem, I changed the value to false and now I get a different error:

2011-05-18 10:15:47,319 ERROR mojoPortal.Web.ContactUI.ContactForm - error sending email from address was "email address" to address was "email address"
System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

I changed the real emails deliberately. 

5/18/2011 5:46:23 AM
Gravatar
Total Posts 18439

Re: email configurations using Gmail smtp server

that error sounds like the SSL certificate on the gmail server is not valid. Seems unlikely but then again even the big players mess up sometimes.

I would try setting <add key="SMTPUseSsl" value="false" /> and see if that does anything to the error message.

5/18/2011 6:45:30 AM
Gravatar
Total Posts 4

Re: email configurations using Gmail smtp server

great!!! it is working now, thank you so much for your help!

 

5/18/2011 6:50:18 AM
Gravatar
Total Posts 18439

Re: email configurations using Gmail smtp server

Thank you for the beer! Much appreciated.

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.