Buggy code:
public class Emailer { private static final Logger log = AppVetProperties . log ; static Properties mailServerProperties ; static Session getMailSession ; static MimeMessage generateMailMessage ; static List < UserInfo > adminUsers = null ; public static void sendEmail ( String recipient , String subject , String content ) { if ( AppVetProperties . emailEnabled ) { String smtpHost = AppVetProperties . SMTP_HOST ; String smtpPort = AppVetProperties . SMTP_PORT ; boolean smtpAuth = AppVetProperties . SMTP_AUTH ; boolean enableTls = AppVetProperties . ENABLE_TLS ; String senderEmail = AppVetProperties . SENDER_EMAIL ; String senderName = AppVetProperties . SENDER_NAME ; String senderEmailPassword = AppVetProperties . SENDER_EMAIL_PASSWORD ; String connectionTimeout = AppVetProperties . EMAIL_CONNECTION_TIMEOUT ; try { Emailer . mailServerProperties = System . getProperties ( ) ; Emailer . mailServerProperties . put ( "mail.smtp.host" , smtpHost ) ; Emailer . mailServerProperties . put ( "mail.smtp.port" , smtpPort ) ; Emailer . mailServerProperties . put ( "mail.from" , senderEmail ) ; Emailer . mailServerProperties . put ( "mail.user" , senderEmail ) ; Emailer . mailServerProperties . put ( "mail.smtp.auth" , smtpAuth ) ; Emailer . mailServerProperties . put ( "mail.smtp.starttls.enable" , enableTls ) ; Emailer . mailServerProperties . put ( "mail.smtp.connectiontimeout" , connectionTimeout ) ; Emailer . getMailSession = Session . getDefaultInstance ( Emailer . mailServerProperties , null ) ; Emailer . generateMailMessage = new MimeMessage ( Emailer . getMailSession ) ; Emailer . generateMailMessage . setFrom ( new InternetAddress ( senderEmail , senderName ) ) ; Emailer . generateMailMessage . addRecipient ( TO , new InternetAddress ( recipient ) ) ; for ( int i = 0 ; i < ( Emailer . adminUsers . size ( ) ) ; i ++ ) { UserInfo adminUser = Emailer . adminUsers . get ( i ) ; String adminUserEmail = adminUser . getEmail ( ) ; if ( ! ( adminUserEmail . equals ( senderEmail ) ) ) { Emailer . generateMailMessage . addRecipient ( BCC , new InternetAddress ( adminUserEmail ) ) ; } } <START_BUG> Emailer . generateMailMessage . setSubject ( ( "[AppVet]<seq2seq4repair_space>" + subject ) ) ; <END_BUG> Emailer . generateMailMessage . setContent ( content , "text//html" ) ; Transport transport = Emailer . getMailSession . getTransport ( "smtp" ) ; if ( ! smtpAuth ) { transport . connect ( ) ; } else { transport . connect ( smtpHost , senderEmail , senderEmailPassword ) ; } transport . sendMessage ( Emailer . generateMailMessage , Emailer . generateMailMessage . getAllRecipients ( ) ) ; transport . close ( ) ; Emailer . log . debug ( ( ( ( "\nEmail<seq2seq4repair_space>\'" + subject ) + "'<seq2seq4repair_space>successfully<seq2seq4repair_space>sent<seq2seq4repair_space>to<seq2seq4repair_space>" ) + recipient ) ) ; } catch ( Exception e ) { Emailer . log . error ( ( "Error<seq2seq4repair_space>sending<seq2seq4repair_space>email.\n" + ( e . getMessage ( ) ) ) ) ; } } else { Emailer . log . warn ( ( ( "Email<seq2seq4repair_space>is<seq2seq4repair_space>disabled.<seq2seq4repair_space>Cannot<seq2seq4repair_space>send<seq2seq4repair_space>message<seq2seq4repair_space>'" + subject ) + "'." ) ) ; } } public static boolean testConnection ( ) { } No newline ; at end ; of file ; }

Fix:
Emailer . generateMailMessage . setSubject ( subject ) ;