Skip to content

Instantly share code, notes, and snippets.

View kabiridris's full-sized avatar
💭
coding

Kabir Idris kabiridris

💭
coding
View GitHub Profile
@christianoguedes
christianoguedes / mail.java
Created February 24, 2014 14:05
Send Mail (Amazon SimpleMail) with Attachement
public static void sendMail(String subject, String message, byte[] attachement, String fileName, String contentType, String from, String[] to) {
try {
// JavaMail representation of the message
Session s = Session.getInstance(new Properties(), null);
MimeMessage mimeMessage = new MimeMessage(s);
// Sender and recipient
mimeMessage.setFrom(new InternetAddress(from));
for (String toMail : to) {
mimeMessage.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(toMail));
@neilgupta
neilgupta / SGEmail.java
Created July 28, 2012 18:48
Send emails via SMTP & SendGrid
package com.tabuleapp.SendGrid;
import javax.mail.Authenticator;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;