Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6904607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:04:56+00:00 2026-05-27T08:04:56+00:00

I want to send log files to a given email address. Here is how

  • 0

I want to send log files to a given email address. Here is how I tried it.But it didn’t work.

    import org.apache.log4j.Logger;   
import org.apache.log4j.PatternLayout;  
import org.apache.log4j.net.SMTPAppender;  

public class LogSender {  
    static Logger logger = Logger.getLogger(test.class);  
    SMTPAppender appender = new SMTPAppender();   
    public test() {  
        try {  
            appender.setTo("receiver@gmail.com");  
            appender.setFrom("sender@gmail.com");  
            appender.setSMTPHost("smtp.gmail.com");  
                    appender.setSMTPUsername("sender@gmail.com");  
                    appender.setSMTPPassword("mypassword");   
            appender.setLocationInfo(true);  
            appender.setSubject("Test Mail From Log4J");  
            appender.setLayout(new PatternLayout());  
            appender.activateOptions();  
            logger.addAppender(appender);           
            logger.error("This is an error");  
        }  
        catch(Exception e) {  
            e.printStackTrace();  
            logger.error("Thrown exception",e);  
        }  
    }   
    public static void main(String args[]) {  
        LogSender l = new LogSender;        
    }  
}   

There is an exceptions saying

    log4j:ERROR Error occured while sending e-mail notification.
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. ee6sm12133321igc.6  

Any one tell my where the problem is and how I can solve this or give me any working sample code please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:04:57+00:00Added an answer on May 27, 2026 at 8:04 am

    Looks like you need to use secure connection: http://railsforum.com/viewtopic.php?id=20777. Some links: http://www.tgerm.com/2010/05/log4j-smtpappender-gmail-custom.html, http://codelol.com/2009/09/log4j-smtpappender-and-authentication/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want so send every week an update by email. But Im afraid that
I want to send email from a Ruby application. Is there a call in
I want to send an Email message after a page is returned to the
I have a situation wherein I want to send error and log messages to
I tried to upload file with connect-form , but if i want to upload
For testing purposes I want send mail to my localhost user account rather than
Want to send the text from my current vb application to the Active Window
I want to send an array constructed in javascript with the selected values of
I want to send a message to a thread and handle it in the
I want to send some strings in a list in a POST call. eg:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.