title: com.sun.mail.smtp.SMTPSendFailedException: 541 5.4.1 Content blocked by Internal Firewall
body: <p>I am getting 541 5.4.1 Content blocked by Internal Firewall exception when i am sending a email in java. I have to send a calendar event so i am using String buffer and appending the content, when iam setting the content and sending email , i am getting blocked by internet firewall.
  Below iam keeping the code.</p>
  <pre><code>public void send(Appointment appointment, String host) throws Exception {
  
          try {
  
              Properties prop = new Properties();
              prop.put(&quot;mail.smtp.host&quot;, host);
              prop.put(&quot;mail.smtp.port&quot;, &quot;25&quot;);
              prop.put(&quot;mail.smtp.auth&quot;, &quot;false&quot;);
              prop.put(&quot;mail.smtp.starttls.enable&quot;, &quot;false&quot;);
  
              Session session = Session.getDefaultInstance(prop, null);
              // Define message
              MimeMessage message = new MimeMessage(session);
              message.addHeaderLine(&quot;method=REQUEST&quot;);
              message.addHeaderLine(&quot;charset=UTF-8&quot;);
              message.addHeaderLine(&quot;component=VEVENT&quot;);
  
              String toMa = StringUtils.getCommaDelimitedStringfromStringList(appointment.getTo());
              String ccMa = StringUtils.getCommaDelimitedStringfromStringList(appointment.getCc());
  
              message.setFrom(new InternetAddress(appointment.getFrom()));
              message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toMa));
              message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(ccMa));
              message.setSubject(appointment.getSubject());
              message.setHeader(&quot;Content-class&quot;, &quot;urn:content-classes:calendarmessage&quot;);
  
              String content = getICSString2(appointment, message);
  
              // Create the message part
              BodyPart messageBodyPart = new MimeBodyPart();
  
              // Fill the message
              messageBodyPart.setHeader(&quot;Content-Class&quot;, &quot;urn:content-  
    classes:calendarmessage&quot;);
              messageBodyPart.setHeader(&quot;Content-ID&quot;, &quot;calendar_message&quot;);
              messageBodyPart.setDataHandler(new DataHandler(new ByteArrayDataSource(content, &quot;text/calendar&quot;)));// very
                                                                                                                  // important
  
              // Create a Multipart
              Multipart multipart = new MimeMultipart();
  
              // Add part one
              multipart.addBodyPart(messageBodyPart);
  
              // Put parts in message
              message.setContent(multipart);
  
              // send message
              Transport.send(message);
          }
          catch (MessagingException me) {
              me.printStackTrace();
          }
          catch (Exception ex) {
              ex.printStackTrace();
          }
      }
  
  private String getICSString2(Appointment appointment, MimeMessage message) {
  
          StringBuilder str = new StringBuilder();
  
          str.append(&quot;BEGIN:VCALENDAR&quot;);
          str.append(&quot;PRODID: Asset View 2.0&quot;);
          str.append(&quot;METHOD:REQUEST&quot;);
          str.append(&quot;BEGIN:VEVENT&quot;);
  
          str.append(&quot;DTSTAMP:&quot; + extracted(FORMATED_DATE_TIME, 0, null));
  
          if (appointment.isIsAllDayEvent()) {
  
              str.append(&quot;DTSTART;VALUE=DATE:&quot; + extracted(FORMATED_DATE, 0, appointment.getStartDate()));
              str.append(&quot;DTEND;VALUE=DATE:&quot; + extracted(FORMATED_DATE, 1, appointment.getStartDate()));
  
          }
          else {
              str.append(&quot;DTSTART;VALUE=DATE:&quot; + extracted(FORMATED_DATE_TIME, 0, appointment.getStartDate()));
              str.append(&quot;DTEND;VALUE=DATE:&quot; + extracted(FORMATED_DATE_TIME, 0, appointment.getEndDate()));
          }
  
          createRecurringEvents(appointment, str);
          str.append(&quot;LOCATION: &quot; + appointment.getLocation());
          str.append(String.format(&quot;UID:%s&quot;, UUID.randomUUID().toString()));
          str.append(String.format(&quot;DESCRIPTION:%s&quot;, appointment.getContent()));
          str.append(String.format(&quot;X-ALT-DESC;FMTTYPE=text/html:%s&quot;, appointment.getContent()));
          str.append(String.format(&quot;SUMMARY:%s&quot;, appointment.getSubject()));
          str.append(String.format(&quot;ORGANIZER:MAILTO:%s&quot;, appointment.getFrom()));
          str.append(String.format(&quot;ATTENDEE;CN=\&quot;%s\&quot;;RSVP=TRUE:mailto:%s&quot;,
                  appointment.getTo().stream().findFirst().orElse(null),
                  appointment.getTo().stream().findFirst().orElse(null)));
          str.append(&quot;X-MICROSOFT-CDO-BUSYSTATUS:FREE&quot;);
  
          str.append(&quot;BEGIN:VALARM&quot;);
          str.append(&quot;ACTION:DISPLAY&quot;);
          str.append(&quot;DESCRIPTION:REMINDER&quot;);
          str.append(&quot;TRIGGER:-P1D&quot;);
          str.append(&quot;END:VALARM&quot;);
  
          str.append(&quot;END:VEVENT&quot;);
          str.append(&quot;END:VCALENDAR&quot;);
  
          return str.toString();
      }
      
  
  </code></pre>