Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: can’t send email ASAP Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
grimmersnee
Newbie
Newbie


Joined: 01 April 2007
Location: New Zealand
Online Status: Offline
Posts: 2
Posted: 01 April 2007 at 6:38pm | IP Logged Quote grimmersnee

Hi,

We recently purchased MailBee.Net Objects
and we are having problems receiving emails.
If we assign the To: address to a address within our domain it works, else it does not work.
Our smtp server is working and sending emails correctly. But MailBee is not working as stated above.
i need advise ASAP!!!

tHANKS

Here is our code:

public static void SendHtmlPlainTextEmail(HtmlEmail email)
           {
                if (!ValidEmailAddress(email.To))
                 {
                      throw new InvalidEmailAddressException("Invalid email address.");
                }

                // Get the license key for SMTP object
                MailBee.SmtpMail.Smtp.LicenseK ey = ConfigurationSettings.AppSettings["MailBee"];

                // Create SMTP object
                MailBee.SmtpMail.Smtp smtp = new Smtp();

                // Create MailMessage object
                MailBee.Mime.MailMessage msg = new MailBee.Mime.MailMessage();

                // Set e-mail headers
                msg.From.Email = email.From;
                msg.To = EmailAddressCollection.Parse(email.To);
                msg.Subject = email.Subject;

                // Set body contents with html and plain text
                msg.BodyHtmlText = email.Html;
                msg.BodyPlainText = email.PlainText;


                // Add SMTP Server
                smtp.SmtpServers.Add(Configura tionSettings.AppSettings["SmtpMailSmtpServer"]);
            
                smtp.Message = msg;

                smtp.Send();
           }
Back to Top View grimmersnee's Profile Search for other posts by grimmersnee
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 02 April 2007 at 7:54am | IP Logged Quote Andrew

Usually, SMTP servers allow anonymous users to send messages within internal domain only for security/antispam reasons. If you need to send a message to an external domain, you should authenticate yourself. Thus, you should modify the source code of your application to enable SMTP authentication as follows:

Code:
public static void SendHtmlPlainTextEmail(HtmlEmail email)
{
       if (!ValidEmailAddress(email.To))
       {
             throw new InvalidEmailAddressException("Invalid email address.");
       }

       // Get the license key for SMTP object
        MailBee.SmtpMail.Smtp.LicenseKey = ConfigurationSettings.AppSettings["MailBee"];

       // Create SMTP object
        MailBee.SmtpMail.Smtp smtp = new Smtp();

       // Create MailMessage object
        MailBee.Mime.MailMessage msg = new MailBee.Mime.MailMessage();

       // Set e-mail headers
       msg.From.Email = email.From;
       msg.To = EmailAddressCollection.Parse(email.To);
       msg.Subject = email.Subject;

       // Set body contents with html and plain text
       msg.BodyHtmlText = email.Html;
       msg.BodyPlainText = email.PlainText;


       // Add SMTP Server
        smtp.SmtpServers.Add(ConfigurationSettings.AppSettings ["SmtpMailSmtpServer"], "user@domain.com", "secret", AuthenticationMethods.Auto);

       smtp.Message = msg;

       smtp.Send();
}


You should replace username 'user@domain.com' and password 'secret' with valid credentials of your email account on your mail server.


Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
grimmersnee
Newbie
Newbie


Joined: 01 April 2007
Location: New Zealand
Online Status: Offline
Posts: 2
Posted: 02 May 2007 at 9:55pm | IP Logged Quote grimmersnee

what MIME type is the message being created as? 8bit mime, 7bit????

i tried it smtp code with authentication, but we are still getting:

The message contains a content type that is not supported . body type is not supported by remote host.

This has become really urgent so your help is appreciated..

Back to Top View grimmersnee's Profile Search for other posts by grimmersnee
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 03 May 2007 at 8:29am | IP Logged Quote Andrew

Please try the latest version of MailBee.NET.dll.

If the problem persists, this means the problem is on SMTP server side and you will have to disable BINARYMIME in MailBee.

server.SmtpOptions = ExtendedSmtpOptions.No8bitAndBinary;

Assuming that server is an instance of SmtpServer class, member of Smtp.SmtpServers collection.

BINARYMIME is not required for MailBee but SMTP-related protocols require that the mail client used it if the mail message data contain 8 bit characters.

Without BINARYMIME, SMTP server may start converting 8 bit characters to 7 bit. However, we never experienced this in real world. Thus, it's usually safe to disable BINARYMIME.


Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide