🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.linux
1 messages
1 total messages Started by kapilawate Sat, 16 Sep 2006 02:28
null pointer exception in sending mail
#237
Author: kapilawate
Date: Sat, 16 Sep 2006 02:28
45 lines
2323 bytes
hi,

i am working on mailserver project. i want to send mail to any account.
my programs compiles successfully but gives the null pointer expection
when i try to execute the program. i am using javamail api for coding
purpose and linux as os. we are succesfully established the domain
mail.simon.com but are unable to execute as null ptr exception is
thrown. so if anybody has an idea then plz help us. i am also providing
my code with this,

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;

public class Assimilator
{
	public static void main(String[] args)
	{
		try
		{
				Properties props = new Properties();
				props.put("mail.host","email.simon.com");

				Session mailConnection = Session.getInstance(props,null);
				Message msg = new MimeMessage(mailConnection);

				Address from = new InternetAddress("kapil@email.simon.com");
				Address to = new InternetAddress("simon@email.simon.com");

				msg.setContent("Hello! how are you?..........","text/plain");
				msg.setFrom(from);
				msg.setRecipient(Message.RecipientType.TO,to);
				msg.setSubject("Trial");

				Transport.send(msg);
				System.out.println("good");
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}

thanks.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads