SendMail Problem

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.
1/19/2010 3:43:06 AM
Gravatar
Total Posts 14

SendMail Problem

Hi,

I have a problem with sending EMails from the Newsletter Module.

I configure my SMTP settings with <add key="DisableDotNetOpenMail" value="false" />

and everything is fine.

with <add key="DisableDotNetOpenMail" value="true" /> I get an error message.

 The problem is in the new mojo version 2.3.3.2 and 2.3.3.4 he is using all the time

SendMailNormal! I can send prview withDotNetOpenMail but the sending of Newsletter is not working anymore!

But why I can not sending with SendMailNormal?

I tested with different Mail Servers, with the same behavior.

Any idea?

Thanks.

The error message:

2010-01-19 11:22:21,386 DEBUG mojoPortal.Net.Email - In SendEmailNormal(test@eytro.com, m.werther@eytro.com, , , Test 41, <p>Test 41</p>
<p><a href='http://localhost:60941/eletter/Unsubscribe.aspx?u=ef8b46fe-46a7-49f0-8a7b-f60843c7981f&l=e56c4354-5105-4ce5-a1ce-bd699b8c16e1'>abmelden</a></p>, True, Normal)
2010-01-19 11:23:33,605 ERROR mojoPortal.Net.Email - error sending email to m.werther@eytro.com, message was: <p>Test 41</p>
<p><a href='http://localhost:60941/eletter/Unsubscribe.aspx?u=ef8b46fe-46a7-49f0-8a7b-f60843c7981f&l=e56c4354-5105-4ce5-a1ce-bd699b8c16e1'>abmelden</a></p>
System.Net.Mail.SmtpException: Failure sending mail. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
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.SendEmailNormal(SmtpSettings smtpSettings, String from, String replyTo, String to, String cc, String bcc, String subject, String messageBody, Boolean html, String priority, String[] attachmentPaths, String[] attachmentNames) in C:\Projects\MJP\mjp_3_1_9\mojoPortal.Net\Email.cs:line 513

1/19/2010 1:14:19 PM
Gravatar
Total Posts 18439

Re: SendMail Problem

Hi,

What language is your message in?

What value do you have for this setting: <add key="SmtpPreferredEncoding" value="" />?

Best,

Joe

1/19/2010 1:55:36 PM
Gravatar
Total Posts 14

Re: SendMail Problem

Hi Joe,

normaly german, but I tried also with one word like "Test".

I'm using <add key="SmtpPreferredEncoding" value="" />

but I tested also with all the other switches (utf8, unicode, ...)

In my debuger came in the System.Net.Mail.SMTPException a message like ("Represents text as a series from unicode").

messageBody = "<p>Test</p>\r\n<p><a href='http://localhost:60941/eletter/Unsubscribe.aspx?u=ef8b46fe-46a7-49f0-8a7b-f60843c7981f&l=e56c4354-5105-4ce5-a1ce-bd699b8c16e1'>abmelden</a></p>"

Thanks for your help,

Michael

1/19/2010 2:13:04 PM
Gravatar
Total Posts 18439

Re: SendMail Problem

It seems strange because it is getting s null reference when trying to get a connection with the smtp server

at System.Net.Mail.SmtpConnection.GetConnection

and this would make me think the smtp settings are incorrect.

But, you say it does work if you set <add key="DisableDotNetOpenMail" value="false" />

which means the settings are correct enough for DotNetOpenMail library to send ok, so they should be the same when using the System.Net classes.

But, also you say with DotNetOpenMail, it is only the preview which works but not sending to the list.

The difference is that the preview sends the preview right away, whereas the list creates a task that runs on a background thread and sends the mail top the list members.

The task gets serialized into the database first and then is deserialized on a background thread. Occasionally we have had issues where the task could not deserialize due to localization issues.

Are you seeing any errors in your mojoPortal log related to serialization or tasks?

However, if it can send a preview with DotNetOpenMail, it should also be able to send a preview with the normal System.Net classes. So it is very mysterious.

Best,

Joe

 

1/19/2010 2:47:27 PM
Gravatar
Total Posts 14

Re: SendMail Problem

yes is very mysterios.

In my version 2.3.3.2 is sending from the list now with DotNetOpenMail if I'm deleting the Mail addresses from the settings, because of the code in the email.cs:

// DotNetOpenMail doesn't support replyto
if (replyTo.Length > 0)
{
SendEmailNormal(
smtpSettings,
from,
replyTo,
to,
cc,
bcc,
subject,
messageBody,
html,
priority);

return;
}

But I need an reply address for sending mails?

With the System.Net class: I found only messages about the mojoPortal.Net.Email problem.

In the log4net.config I switched to Debug mode!

For the moment I have no idea where can be the probelm with the System.Net class.

br,

Michael

1/20/2010 12:44:07 PM
Gravatar
Total Posts 18439

Re: SendMail Problem

Are you forcing German culture like this?:

<add key="UseCultureOverride" value="true" />
<add key="site1culture" value="de-DE" />

Does it behave different if you use en-US?

1/20/2010 4:20:57 PM
Gravatar
Total Posts 14

Re: SendMail Problem

I tested, but is the same.

I changed the email.cs (now I can send the newletter with DotNetOpenMail).

But System.Net don't want!

1/21/2010 12:34:06 AM
Gravatar
Total Posts 171
I am a Russian programmer

Re: SendMail Problem

to mwdvb

You error is

System.NullReferenceException: Object reference not set to an instance of an object.
 

set

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

And everything will be fine

Best regards, Alexander

1/21/2010 10:35:37 AM
Gravatar
Total Posts 14

Re: SendMail Problem

Hi Alexander,

 

with this setting I got another error (invalid settings)!

 

br,

 

Michael

1/21/2010 3:03:37 PM
Gravatar
Total Posts 18439

Re: SendMail Problem

Micheal,

When it sends to the list it uses the from address configured on the newsletter itself whereas when you send a preview it uses the site settings from email address. Do you have a valid address configured in the newsletter definition?

Hope it helps,

Joe

1/22/2010 9:34:11 AM
Gravatar
Total Posts 14

Re: SendMail Problem

Joe,

 

yes of course.

It's sending now from the list but only with DotNetOpenMail.

I have changed the email.cs from mojoPortal.Net.

The following I don't understand, i have disbaled it and it's working now with DotNetOpenMail.

// DotNetOpenMail doesn't support replyto
if (replyTo.Length > 0)

The same problem was in version 2.3.3.2, 2.3.3.4 and 2.3.3.4b

All I tried it was not working with System.Net.Mail

br,

Michael
 

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