504 Unrecognized authentication type

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
1/19/2008 5:10:26 PM
Gravatar
Total Posts 112

504 Unrecognized authentication type

Hi Joe;

I'm getting the System Log error "504 Unrecognized authentication type" when I try to Send a Newsletter. I don't think it's a Newsletter problem, I think I've buggered up my SMTP settings, somehow. I've used the web.config setting values in other c# code and it was able to send email without problem. (UseDefaultCredentials appears to a property in System.Net.Mail.SmtpClient that is required for Google email; but, I don't see it available in web.config.)

System Log error:

2008-01-19 10:53:56,045 [5572] ERROR mojoPortal.Business.LetterSendTask [(null)] - 504 Unrecognized authentication type

Key parts of web.config:

<add key="SMTPServer" value="smtp.gmail.com" />
<add key="SMTPRequiresAuthentication" value="true" />
<add key="SMTPUseSsl" value="true" />
<add key="SMTPPort" value="587" />
<add key="SMTPUser" value="MooreWorksService@gMail.Com" />
<add key="SMTPPassword" value="foo" />
<add key="SMTPTimeoutInMilliseconds" value="15000" />
<add key="DefaultEmailFrom" value="DaleEMoore@gMail.Com" />
<add key="WebMaster" value="DaleEMoore@gMail.Com" />

and further down for PasswordRecovery must be in web.config and will be overwritten on next upgrade of MP:

<system.net>
<mailSettings>
<smtp from="DaleEMoore@gMail.Com">
<network
host="smtp.gmail.com"
port="587"
password="foo"
userName="MooreWorksService@gMail.Com"
defaultCredentials="false"
/>
</smtp>
</mailSettings>
</system.net>

Any help you can provide is very much appreciated,
Dale E. Moore
 

1/19/2008 5:24:27 PM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

Hi Dale,

Its true you need to backup your web.config and restore customizations after an upgrade.

You can reduce the effort by putting any customizations from the appSettings section in a user.config file. In the source code at the root of the web is a user.config.sample file that you can open and save as user.config then put your appSettings customizations there and you won't have to worry about losing those settings.

Of couse other sections like the system.net section you still have to re-apply your customizations.

Be aware however, when you make a change in user.config the system won't detect it automatically so you have to touch the Web.confiig file by opening it type a space and save. This will make it reload all settings including your user.config.

To troubleshoot I would use a Cpontact Form module and tweak your settings until it works. First thing I would try is set SMTPUseSsl to false. I know yahoo says to use sssl but in my trials it didn't work with this set to true, so gmail may be the same.

The system.net section smtp settings are only used by built in .NET controls like PasswordRecovery. All the custom features use the appSettings section settings.

Hope it helps,

Joe

1/21/2008 2:52:07 PM
Gravatar
Total Posts 112

Re: 504 Unrecognized authentication type

The Contact form tells me "Thank You! Your message has been sent." But no message is ever received at the destination. I wrote a little code to run on the same server and see if I could figure out why the message was never received... Perhaps the server didn't send it. But my code sends the email...

Code to send test email:

System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(ToTextBox1.Text);
message.Subject = SubjectTextBox1.Text;
message.From = new System.Net.Mail.MailAddress(FromTextBox1.Text);
message.Body = "test";
message.IsBodyHtml = IsHTMLCheckBox1.Checked ? true : false;

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(HostTextBox1.Text, Convert.ToInt32(PortTextBox1.Text));
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(UserNameTextBox1.Text, PasswordTextBox1.Text);
smtp.UseDefaultCredentials = UseDefaultCredentialsCheckBox1.Checked ? true : false;
smtp.EnableSsl = EnableSSLCheckBox1.Checked ? true : false;
smtp.Credentials = SMTPUserInfo;
s1 = message.Body;
try
{
smtp.Send(message);
StatusTextBox1.Text = "OK";
}
catch (Exception ex)
{
StatusTextBox1.Text = ex.ToString();
}
message.Dispose(); // Free up the attachment once sent.

Form parameters:

Host: mail.mooreworks.net
Port: 25
Username: mworks@mooreworks.net
Use Default Credentials: True
Enable SSL: False
From: DaleEMoore@gMail.Com
To: DaleEMoore@gMail.Com
Subject: c2 smtpTest1
Is HTML: False
 

1/21/2008 4:05:58 PM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

Look in the mojoportal system log and you should see error messages if it failed to send.

Joe

1/21/2008 5:01:08 PM
Gravatar
Total Posts 112

Re: 504 Unrecognized authentication type

I cleared the System Log before running the Contact form and afterwards there are no entries in the system log and the Contact form says "Thank You! Your message has been sent."

 

 

 

1/22/2008 1:03:15 PM
Gravatar
Total Posts 112

Re: 504 Unrecognized authentication type

Hi Joe;

In Web.config after "</configSections>" I inserted:

<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.Net" >
<listeners>
<add name="MyTraceFile"/>
</listeners>
</source>
<source name="System.Net.Sockets">
<listeners>
<add name="MyTraceFile"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add
name="MyTraceFile"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\System.Net.trace.log" />
</sharedListeners>
<switches>
<add name="System.Net" value="Verbose" />
<add name="System.Net.Sockets" value="Verbose" />
</switches>
</system.diagnostics>

and got:

System.Net.Sockets Verbose: 0 : [4364] SmtpProxy#28145867::TcpClient(InterNetwork#2)
System.Net.Sockets Verbose: 0 : [4364] Socket#58604500::Socket(InterNetwork#2)
System.Net.Sockets Verbose: 0 : [4364] Exiting Socket#58604500::Socket()
System.Net.Sockets Verbose: 0 : [4364] Exiting SmtpProxy#28145867::TcpClient()
System.Net.Sockets Verbose: 0 : [4364] SmtpProxy#28145867::TcpClient()
System.Net.Sockets Verbose: 0 : [4364] Exiting SmtpProxy#28145867::TcpClient()
System.Net.Sockets Verbose: 0 : [4364] DNS::GetHostEntry(mail.mooreworks.net)
System.Net.Sockets Verbose: 0 : [4364] DNS::GetHostByName(mail.mooreworks.net)
System.Net.Sockets Verbose: 0 : [4364] Exiting DNS::GetHostByName() -> IPHostEntry#19956848
System.Net.Sockets Verbose: 0 : [4364] Exiting DNS::GetHostEntry() -> IPHostEntry#19956848
System.Net.Sockets Verbose: 0 : [4364] SmtpProxy#28145867::Connect(4:25#69166143)
System.Net.Sockets Verbose: 0 : [4364] Socket#58604500::Connect(4:25#69166143)
System.Net.Sockets Error: 0 : [4364] Exception in the Socket#58604500::Connect - No connection could be made because the target machine actively refused it 38.100.31.4:25
System.Net.Sockets Verbose: 0 : [3456] Socket#58604500::Dispose()
System.Net.Sockets Verbose: 0 : [3456] SmtpProxy#28145867::Dispose()
System.Net.Sockets Verbose: 0 : [3456] Exiting SmtpProxy#28145867::Dispose()

Though Contact Form still said "Thank You! Your message has been sent."

Now I'll start trying different connection options, and different mail hosts to see which works for me.

Thanks,
Dale

1/22/2008 4:10:16 PM
Gravatar
Total Posts 112

Re: 504 Unrecognized authentication type

I'm hoping that you (careful reader) will have some insight into this oddity; none of my searches have brought me any insight. I'm trying to turn on web.config system.diagnostics on my production machine as I mentioned in a previous post which works on my development machine. But I am unable to get any logging, or even create the log file.

I moved the <system.diagnostics> section to before <configSections> and got the normal error, so I know I'm fiddling with the correct web.config file. I've created the c:\System.Net.trace.log and granted everyone full access, but; no logging entries ever appear.

Any suggestions you have are very much appreciated,
Dale E. Moore

1/23/2008 5:34:41 AM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

Hi Dale,

It will show the message sent message and just log it if it catches a MailException or a SocketException

try
{
mail.Send(smtpServer);
}
catch (MailException ex)
{
log.Error("error sending email, message was: " + messageBody, ex);
}
catch (SocketException ex)
{
log.Error("error sending email, message was: " + messageBody, ex);
}

So don't go by that message. The error may not appear immediately in the log, it may be bufferred in memory for a while and written to the log in batches to avoid file IO contention. You may want to review your log4net.config file.

The error you are getting indicates the server refused actively the connection. This means something isn't right in your configuratioon or credentials.

In the future I plan to add a db table to the contact form feature and capture all messages there and make a web page to review them. That way even if smtp fails the message wil be accessible.

 

Joe

1/23/2008 11:02:07 AM
Gravatar
Total Posts 112

Re: 504 Unrecognized authentication type

Thanks everyone (Joe:):

I was never successfull with Google's smtp.gmail.com:( But a different email server is working fine for me now. I was surprised to discover that the Contact Form, Feature Instance Settings, e-mail address MUST be correct also or authentication fails.

Metta,
Dale E. Moore

12/19/2008 8:18:02 AM
Gravatar
Total Posts 8

Re: 504 Unrecognized authentication type

I am getting exactly the same error message when trying to send emails using Gmail.The same setttings and account works for a DNN installation and BlogEngine.Net. Unfornately, my SMTP host is clamping down on # of messages sent from my virtual host per day to fight SPAM. So GMail was my last hope. Anyone got Gmail to work with Mojo? Thanks!

12/19/2008 8:19:18 AM
Gravatar
Total Posts 8

Re: 504 Unrecognized authentication type

Sorry, forgot to include the error message from the log.

Error message from the log: 2008-12-19 09:01:10,697 ERROR mojoPortal.Web.ContactUI.ContactForm - 504 Unrecognized authentication type

12/19/2008 9:08:49 AM
Gravatar
Total Posts 112

Re: 504 Unrecognized authentication type

Hi draftversion;

I was never able to make this work. I wish I had good insights to share with you!!

Metta,
Dale E. Moore

12/19/2008 3:11:58 PM
Gravatar
Total Posts 8

Re: 504 Unrecognized authentication type

Still nibbling on this issue...

Quick question: where does the app get the administrator's email address, to use for the contact form? Thanks!

12/19/2008 3:47:53 PM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

The from address is going to be the address specified in Site Settings. If using gmail you should put your gmail email address there.

Hope it helps,

Joe

12/19/2008 5:04:47 PM
Gravatar
Total Posts 8

Re: 504 Unrecognized authentication type

OK, here's what I've found so far: The "to" parameter seems to be empty when it's passed to SendEmail in Email.cs. When I hardcode the "to" variable to my email within the SendEmail method, the email is sent correctly. The app loops through the list of users with the admin role and then send an email to each of these users. I have checked the data and it seems to be OK. I can't really debug it because I don't have VS 2008 installed. I have VS 2005, but don't have all the necessary componeents. I'm running the site off of mojoportal-2-2-8-0-mssqlreleasefiles.zip.

Anyway, the hard part is fixing the cause of the problem.

Thanks.

 

12/20/2008 6:41:42 AM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

If you have VS 2005 SP1 you should be able to debug it using the mojoportal-complate-vs2005.sln

I reviewed the code this morning and don't see how it could not have the to address, but I added some logic to make sure it is valid and throw an error if not. So it will throw a different error if that is the case. A new release is coming today or tomorrow.

Best,

Joe

12/20/2008 1:37:59 PM
Gravatar
Total Posts 8

Re: 504 Unrecognized authentication type

I reinstalled today's release on a new VM. Here's the new message:

2008-12-20 14:32:04,250 ERROR mojoPortal.Web.ContactUI.ContactForm - DotNetOpenMail.MailException: no valid email address provided for To
at mojoPortal.Net.Email.SendEmail(SmtpSettings smtpSettings, String from, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority) in C:\projects\MojoPortal\mojoPortal.Net\Email.cs:line 141
at mojoPortal.Web.ContactUI.ContactForm.btnSend_Click(Object sender, EventArgs e)
 

I'm starting to think that I might have missed a step in the installation process. I have set my email in the web.config ("smtp from" key) user profile and in Site Settings. I will let you know if I find anything else. I appreciate your support.

12/20/2008 1:43:04 PM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

The contact form has to have its "to" address set as well. Click the gear icon next to the title of the contact form and put the email address that you want contact messages to go to there.

Hope it helps,

Joe

12/20/2008 3:21:39 PM
Gravatar
Total Posts 8

Re: 504 Unrecognized authentication type

I found out that I had two issues. I came with with kludgy workarounds for now.

1. Empty "to" value when using the contact form

Cause:settingvalue in the mp_ModuleSettings table was empty.
Workaround: run the following SQL statement manually, note the id is probably specific to my installation
  update mp_ModuleSettings set settingvalue = 'me@domain.com' where id = 4 --the matching settingName should be 'ContactFormEmailSetting'

2. 504 error

cause: Gmail just doesn't seem to like DotNetOpenMail.
Workaround: replace SendEmail with SendEmailNormal

So far, the 2 workarounds above seem to be working. Fingers crossed. :p

12/20/2008 3:29:39 PM
Gravatar
Total Posts 18439

Re: 504 Unrecognized authentication type

Hi,

1. Was addressed in my previous post. You don't need to run any sql, you do need to set the address and save it in the module settings for the contact form.

2. I'll accept your word on that and will add a config setting for whether to use DotNetOpenMail. This will be available in the next release or in a few days in svn trunk. The advantage of DotNetOpenMail is that it has support for multi part messages that contain both an html body and a plain text body in the same message. But in practice we can live without it. There is already a Web config setting that will make it not use DotNetOpenMail. If you set RunningInMediumTrust to true it won't use DotNetOpenMail, but it will also disable OpenID authentication, so depending on whether you care about that, you could use this setting now.

Best,

Joe

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