w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
JavaMail: MessagingException: Got bad greeting from SMTP host — Error Code 250
Try this public static void mail(Reporter report) { if(!sendEmail.trim().equalsIgnoreCase("true")){ return; } Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("from-email@gmail.c

Categories : Java

12 Days Of Christmas C Program in Functions
Use a void function. void print12DaysOfChristmas(void) { // Paste all your code here } int main(void) // Main Function { print12DaysOfChristmas(); return 0; } Notes: About the function signatures in C, see this answer. If the function were not defined before main, you would need to use a forward declaration.

Categories : C

How do I make a christmas tree whose lines go 1, 3, 5, 3, 5, 7, 5, 7, 9, 7, 9
The first step would probably be to abstract stuff. I mean, make a method that prints just one line of this tree: private static void branch(int width,int centerPoint) { for (int i = 0; i < centerPoint - width / 2; i++) { System.out.print(' '); } for (int i = 0; i < width; i++) { System.out.print('x'); } } Then you can make a tree with any shape you like: public static void main(String... args) { System.out.println("Hvor mange rader skal pyramiden ha?"); Scanner scanner = new Scanner(System.in); int numRows = scanner.nextInt(); int width = 1; for (int i = 0;i < numRows;i++) { branch(width,numRows / 3 + 2); if (width % 3 == 2) width -= 2; //Reduces the width by 2 if it's line 2, 5, 8, etc. e

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.