Author |
|
Aishi Newbie
Joined: 15 June 2015 Location: Russian Federation
Online Status: Offline Posts: 3
|
Posted: 15 June 2015 at 4:29am | IP Logged
|
|
|
Hello.
I use old version of MailBee.Net (7.1.2.340).
I send messages with MailBee.SmtpMail.Smtp.
sample of code:
Code:
var mailer = new MailBee.SmtpMail.Smtp();
var smtpserver = new MailBee.SmtpMail.SmtpServer(smtp.Server);
//auth settings for smtpserver .....
mailer.SmtpServers.Add(smtpserver);
mailer.Connect();
mailer.Hello();
if (authorizationmode != (int)SmtpAuthorizationMode.None)
mailer.Login();
foreach(var notification in notifications)
{
mailer.ResetMessage();
mailer.Subject = notification.Subject.GetFirstSubstring(99);
mailer.BodyHtmlText = notification.Body;
mailer.Message.Charset = "utf-8";
mailer.Message.EncodeAllHeaders(System.Text.Encoding.UTF8, HeaderEncodingOptions.None);
mailer.From.AsString = notification.EmailFrom;
mailer.To.Add(notification.EmailTo);
mailer.Message.From = new EmailAddress(notification.EmailFrom);
mailer.Message.To = new EmailAddressCollection(notification.EmailTo);
mailer.Send();
}
|
|
|
I have a problem with some messages. Some messages look is good, but some messages contains 2 different parts of mail: html part is real for mail's subject but plaintext part is from another notification in my list of notification.
Question: maybe my code is wrong?
Or maybe it is a bug in MailBee.Net v.7.1.2?
If it is bug then new version help me resolve this problem?
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 15 June 2015 at 5:28am | IP Logged
|
|
|
In your code, you're setting BodyHtmlText property but BodyPlainText isn't explicitly set anywhere. You should either call MakePlainBodyFromHtmlBody method after assigning HTML body, or make sure MessageBuilderConfig.HtmlToPlainMode is set to HtmlToPlainAutoConvert.IfHtml value.
Also, you seem to be setting From and To twice, through mailer and mailer.Message, setting via either of those should suffice.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
Aishi Newbie
Joined: 15 June 2015 Location: Russian Federation
Online Status: Offline Posts: 3
|
Posted: 16 June 2015 at 12:05am | IP Logged
|
|
|
Thanks for your reply.
I try this
Code:
mailer.Message.Subject = notification.Subject.GetFirstSubstring(99);
mailer.Message.BodyHtmlText = notification.Body;
mailer.Message.MakePlainBodyFromHtmlBody();
mailer.Message.Charset = "utf-8";
mailer.Message.EncodeAllHeaders(System.Text.Encoding.UTF8, HeaderEncodingOptions.None);
mailer.Message.From = new EmailAddress(eMailFrom);
mailer.Message.To = new EmailAddressCollection(email);
|
|
|
If this doesn't help, then I will write a new message here
|
Back to Top |
|
|
Aishi Newbie
Joined: 15 June 2015 Location: Russian Federation
Online Status: Offline Posts: 3
|
Posted: 01 July 2015 at 1:03am | IP Logged
|
|
|
This decision helped me.
Thanks!!
|
Back to Top |
|
|