View Category

Check your language appears on the langref.org site

Your language name should appear within the HTML found at the http://langreg.org main page.
scala
val url = "http://langref.org/" ; val language = "scala" ; val srchexp = url + language;

val source = Source.fromURL(url).getLines

while (source.hasNext) if (source.next.contains(srchexp)) printf("Language %s exists @ %s\n", language, url)

Send an email

Use library functions, classes or objects to create a short email addressed to your own email address. The subject should be, "Greetings from langref.org", and the user should be prompted for the message body, and whether to cancel or proceed with sending the email.
scala
// requires Java Mail API (mail.jar), which must be in classpath

import javax.mail._
import javax.mail.internet._
import java.util.Properties._

// Get the user's message
println("Enter the text you wish to send in the message (hit Ctrl-D to finish):")
var bodyText = ""
var line = readLine
while (line != null) {
bodyText += line
line = readLine
}

// Confirm they want to send
println("Are you sure you want to send the message? [y/N]")
val yesOrNo = readLine
if (yesOrNo != "y" && yesOrNo != "Y") {
println("Aborted")
exit
}

// Set up the mail object
val properties = System.getProperties
properties.put("mail.smtp.host", "localhost")
val session = Session.getDefaultInstance(properties)
val message = new MimeMessage(session)

// Set the from, to, subject, body text
message.setFrom(new InternetAddress("test@example.org"))
message.setRecipients(Message.RecipientType.TO, "spam@mopoke.co.uk")
message.setSubject("Greetings from langref.org")
message.setText(bodyText)

// And send it
Transport.send(message)
Need a code t send email from smtp server in scala