| Author |  | 
      
        | grimmersnee Newbie
 
  
 
 Joined: 01 April 2007
 Location: New Zealand
 Online Status: Offline
 Posts: 2
 | 
          Hi,
           | Posted: 01 April 2007 at 6:38pm | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          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:
           | Posted: 02 April 2007 at 7:54am | IP Logged |   |  
           | 
 |  
 
 
| 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 |     | 
       
       
        |  | 
        | grimmersnee Newbie
 
  
 
 Joined: 01 April 2007
 Location: New Zealand
 Online Status: Offline
 Posts: 2
 | 
          what MIME type is the message being created as? 8bit mime, 7bit????
           | Posted: 02 May 2007 at 9:55pm | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          Please try the latest version of MailBee.NET.dll.
           | Posted: 03 May 2007 at 8:29am | IP Logged |   |  
           | 
 |  
 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 |     | 
       
       
        |  |