|
 |
Articles |
|
|
|
 |
GEEK |
|
|
|
 |
User's box |
|
|
|
 |
Shoutbox |
| innocentius I win at
OSIX, I
guess.
Onward to
the other
challenges! |
| sefo anilg, new
comments are
deleted
automaticall
y because of
some abuse
recently |
| anilg this is
plain wierd.
I submitted
comments
twice to
article 950,
and they
dont seem to
be there.
Something
wrong with
the comment
code? |
| CodeX shout-boxes
in general
are old +
the staff
thing
happened to
everyone
after an
issue 2
months ago |
| anilg /me is no
longer staff
:( |
|
|
 |
Donate |
|
Donate and help us fund new challenges
|
|
|
|
Due Date:
|
Sep 30 |
|
September Goal:
|
$40.00
|
|
Gross:
|
$0.00 |
|
Net Balance:
|
$0.00 |
|
Left to go:
|
$40.00 |
|
|
|
 |
News Feeds |
|
|
|
|
 |
View Blog |
by jericocampos on Tue 16th Mar 11am
Wow! If not for the password reset, I would have forgotten my account here in OSIX.
Related Blogs
| First one by Action on Tue 12th Jan 10pm
|
|
Yaw, this is the first blog post, just to begin with something. Nice site here, cool features like OSIDrive, and so on. However, strange that an "OpenSource Institute" uses non-OpenSource softare to host its site (Windows and IIS). It's not correct... I thought, they use Linux. |
| Action's blog
|
| A Daily Profanity at dailyprofanity.com by bb on Mon 21st Dec 11am
|
|
For anyone who likes viz, and roger mellies profanisaurus.
There's a website called amusing daily profanity which dishes up a humorous profanity every day via rss, twitter email and a few other ways.
Rather rude words, but very funny in my opinion, although it might just be a .uk thing! |
| bb's blog
|
| Blog entry for Tue 5th May 6am by goldie on Tue 5th May 6am
|
|
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.io.*;
import java.util.Properties;
public class SENDMAIL
{
public void sendMail(String mailServer, String from, String to,
String subject, String messageBody,
String[] attachments) throws
MessagingException, AddressException
{
// Setup mail server
Properties props = System.getProperties();
props.put("mail.smtp.host", mailServer);
// Get a mail session
Session session = Session.getDefaultInstance(props, null);
// Define a new mail message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
// Create a message part to represent the body text
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(messageBody);
//use a MimeMultipart as we need to handle the file attachments
Multipart multipart = new MimeMultipart();
//add the message body to the mime message
multipart.addBodyPart(messageBodyPart);
// add any file attachments to the message
addAtachments(attachments, multipart);
// Put all message parts in the message
message.setContent(multipart);
// Send the message
Transport.send(message);
}
protected void addAtachments(String[] attachments, Multipart multipart)
throws MessagingException, AddressException
{
for(int i = 0; i<= attachments.length -1; i++)
{
String filename = attachments[i];
MimeBodyPart attachmentBodyPart = new MimeBodyPart();
//use a JAF FileDataSource as it does MIME type detection
DataSource source = new FileDataSource(filename);
attachmentBodyPart.setDataHandler(new DataHandler(source));
//assume that the filename you want to send is the same as the
//actual file name - could alter this to remove the file path
attachmentBodyPart.setFileName(filename);
//add the attachment
multipart.addBodyPart(attachmentBodyPart);
}
}
public static void main(String[] args)
{
try
{
SENDMAIL MAIL = new SENDMAIL();
String server="pop3.gmail.com";
String from="username@gmail.com";
String to = "other user href="mailto:name@gmail.com">name@gmail.com";
String subject="Test";
String message="Testing";
String[] filenames =
{"c:/somefile.txt"};
MAIL.sendMail(server,from,to,subject,message,filenames);
}
catch(Exception e)
{
e.printStackTrace(System.out);
}
}
}
i want to send mail using this code but i getting exception like this.
avax.mail.MessagingException: Unknown SMTP host: pop3.gmail.com;
nested exception is:
java.net.UnknownHostException: pop3.gmail.com
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1543)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at SENDMAIL.sendMail(SENDMAIL.java:46)
at SENDMAIL.main(SENDMAIL.java:85)
Caused by: java.net.UnknownHostException: pop3.gmail.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:267)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511)
... 8 more
i have taken code from this siite only plz suggest me how to remove this exception.
thanks in advance. |
| goldie's blog
|
|
|
|
|
 |
About Me |
| n: | jericocampos (Jerico D. Campos) | | l: | Manila, Philippines | | o: | Air Navigation Systems Specialist | | View my Profile |
|
|
 |
Recent Blogs |
|
|
 |
Link To Me |
|
|
|
 |