JavaMail API

By Elliotte Rusty Harold

Send and obtain e mail from Java functions by utilizing the JavaMail API. With this concise e-book, you’ll how one can converse with current SMTP, POP, and IMAP servers, and the way to write down your own.

Whether you want to construct an email-centric software like a mailing checklist supervisor or just upload electronic mail notification to a bigger product, JavaMail is the reply. choked with code examples, this ebook indicates you the way JavaMail allows you to stay away from low-level protocol info, so that you can specialize in what you definitely are looking to say in a message.

  • Send, obtain, and shop electronic mail with POP3 and IMAP
  • Add password authentication for your programs
  • Manage mailboxes and accounts
  • Download mail attachments
  • Respond to asynchronous e-mail events
  • Design protocol-independent e mail programs

Show description

Preview of JavaMail API PDF

Best Java books

Mastering Lambdas: Java Programming in a Multicore World (Oracle Press)

The Definitive consultant to Lambda Expressions getting to know Lambdas: Java Programming in a Multicore international describes how the lambda-related positive aspects of Java SE eight will let Java to fulfill the demanding situations of next-generation parallel architectures. The ebook explains the best way to write lambdas, and the way to exploit them in streams and in assortment processing, delivering code examples all through.

Mastering JavaFX 8 Controls (Oracle Press)

Layout and installation High-Performance JavaFX Controls carry cutting-edge purposes with visually wonderful UIs. gaining knowledge of JavaFX eight Controls presents transparent directions, distinctive examples, and ready-to-use code samples. how to paintings with the newest JavaFX APIs, configure UI parts, immediately generate FXML, construct state-of-the-art controls, and successfully observe CSS styling.

Data Abstraction and Problem Solving with Java: Walls and Mirrors (3rd Edition)

The 3rd variation of information Abstraction and challenge fixing with Java: partitions and Mirrors employs the analogies of partitions (data abstraction) and Mirrors (recursion) to coach Java programming layout ideas, in a fashion that starting scholars locate obtainable. The publication has a student-friendly pedagogical method that conscientiously money owed for the strengths and weaknesses of the Java language.

Java Software Solutions: Foundations of Program Design (7th Edition)

Java software program ideas teaches a origin of programming suggestions to foster well-designed object-oriented software program. Heralded for its integration of small and massive practical examples, this all over the world best-selling textual content emphasizes construction reliable problem-solving and layout abilities to put in writing top quality courses.

Additional info for JavaMail API

Show sample text content

Approach homes used for sending mail PropertyDefault ValuePurpose mail. host Host identify of the mail server mail. smtp. host Host identify of the SMTP server; overrides mail. host for SMTP connections merely mail. protocol. host Host identify of the server for the desired protocol. Overrides mail. host mail. consumer Default username despatched to mail servers mail. protocol. consumer Default username despatched to servers for the desired protocol; e. g. , mail. smtp. person for an SMTP server or mail. smtps. person for an SMTPS server; overrides mail. person mail. smtp. port 25 Port on which the SMTP server is listening mail. protocol. port default port for the protocol Port on which the server for the desired protocol is listening mail. smtp. starttls. permit improve the average SMTP connection at the traditional port to an encrypted (TLS or SSL) connection mail. smtp. connectiontimeout countless variety of milliseconds to attend for a connection prior to striking up mail. debug fake Print a variety of debugging details to the console mail. from the e-mail deal with to take advantage of within the From: header mail. mime. charset dossier. encoding Default personality set used to ship messages. you need to constantly set this to UTF-8 mail. shipping. protocol. address-type The message delivery protocol akin to SMTP for the desired tackle kind; e. g. , mail. shipping. protocol. rfc822 mail. protocol. type absolutely package deal certified category identify of the supplier for the desired protocol mail. delivery. protocol first delivery supplier within the configuration dossier Default protocol with which to ship messages mail. alternates different e mail addresses for the present person that won't be integrated whilst replying to a message mail. replyallcc fake whilst replying to all, placed all recipients within the Cc record of the answer message rather than the To box This consultation item is then used to build a brand new Message item: Message msg = new MimeMessage(session); right here I specify the MimeMessage category particularly considering that i do know I’m sending web e-mail. although, this can be the single position the place I do explicitly pick out a structure for the e-mail message. Now that i've got a Message item, i must arrange its fields and contents. The From: deal with and To: tackle will every one be javax. mail. net. InternetAddress items. you could supply both an electronic mail deal with on my own or an e-mail deal with and a private identify: tackle invoice = new InternetAddress("god@microsoft. com", "Bill Gates"); tackle elliotte = new InternetAddress("elharo@ibiblio. org"); The setFrom() strategy specifies who’s sending the message by means of environment the From: header. There’s no security opposed to forgery. It’s relatively effortless for me to masquerade as invoice Gates at a (presumably) fictitious e-mail deal with: msg. setFrom(bill); The setRecipient() procedure is a little bit extra advanced. You not just need to specify the deal with that the message can be despatched to, yet how that tackle is used; that's, as a To: box, a Cc: box, or a Bcc: box. those are indicated by way of 3 mnemonic constants of the Message.

Download PDF sample

Rated 4.80 of 5 – based on 29 votes