Java Code Examples for org.apache.commons.mail.EmailAttachment#setDescription()
The following examples show how to use
org.apache.commons.mail.EmailAttachment#setDescription() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SendEmail.java From sAINT with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void sendEmailAttachment(String email_to, String assunto, String msg, String file_logs) { File fileLogs = new File(file_logs); EmailAttachment attachmentLogs = new EmailAttachment(); attachmentLogs.setPath(fileLogs.getPath()); attachmentLogs.setDisposition(EmailAttachment.ATTACHMENT); attachmentLogs.setDescription("Logs"); attachmentLogs.setName(fileLogs.getName()); try { MultiPartEmail email = new MultiPartEmail(); email.setDebug(debug); email.setHostName(smtp); email.addTo(email_to); email.setFrom(email_from); email.setAuthentication(email_from, email_password); email.setSubject(assunto); email.setMsg(msg); email.setSSL(true); email.attach(attachmentLogs); email.send(); } catch (EmailException e) { System.out.println(e.getMessage()); } }
Example 2
Source File: SendEmail.java From SpyGen with Apache License 2.0 | 5 votes |
public void attach(String file, String description) { File f = new File(file); EmailAttachment attachment = new EmailAttachment(); attachment.setPath(f.getPath()); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription(description); attachment.setName(f.getName()); try { this.email.attach(attachment); } catch (EmailException se) { se.printStackTrace(); } }
Example 3
Source File: SendEmail.java From sAINT with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void sendEmailAttachment(String email_to, String assunto, String msg, String file, String file_logs) { File fileScreenshot = new File(file); EmailAttachment attachment = new EmailAttachment(); attachment.setPath(fileScreenshot.getPath()); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription("Attachment"); attachment.setName(fileScreenshot.getName()); File fileLogs = new File(file_logs); EmailAttachment attachmentLogs = new EmailAttachment(); attachmentLogs.setPath(fileLogs.getPath()); attachmentLogs.setDisposition(EmailAttachment.ATTACHMENT); attachmentLogs.setDescription("Logs"); attachmentLogs.setName(fileLogs.getName()); try { MultiPartEmail email = new MultiPartEmail(); email.setDebug(debug); email.setHostName(smtp); email.addTo(email_to); email.setFrom(email_from); email.setAuthentication(email_from, email_password); email.setSubject(assunto); email.setMsg(msg); email.setSSL(true); email.attach(attachment); email.attach(attachmentLogs); email.send(); } catch (EmailException e) { System.out.println(e.getMessage()); } }
Example 4
Source File: Mail.java From JARVIS with MIT License | 5 votes |
public void setAttachment(String path,String Description,String name) { EmailAttachment attachment = new EmailAttachment();//�������� attachment.setPath(path);//���ظ���������·�� attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription(Description);//�������� attachment.setName(name);//�������� this.attachment = attachment; }