Subversion Repositories SmartDukaan

Rev

Rev 5138 | Rev 8675 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5138 Rev 5140
Line 103... Line 103...
103
 
103
 
104
    private String extractDomainFromEmailAddress(String recipient) {
104
    private String extractDomainFromEmailAddress(String recipient) {
105
        return recipient.split("@")[1];
105
        return recipient.split("@")[1];
106
    }
106
    }
107
 
107
 
108
    public void sendSSLMessage(String recipients[], String subject, String message, final String from, final String password, String filename, byte[] bytes, String type) throws MessagingException {
-
 
109
    	Message msg = prepareMessage(recipients, subject, from, password);
-
 
110
    	
-
 
111
    	//Create the multi-part object to hold the text and attachment parts
-
 
112
    	Multipart multipart = new MimeMultipart();
-
 
113
    	
-
 
114
    	// create the message part 
-
 
115
    	MimeBodyPart messageBodyPart = new MimeBodyPart();
-
 
116
    	//Part 1: Text message
-
 
117
    	messageBodyPart.setText(message);
-
 
118
    	multipart.addBodyPart(messageBodyPart);
-
 
119
    	
-
 
120
    	//Part 2: Attachment
-
 
121
    	messageBodyPart = new MimeBodyPart();
-
 
122
    	DataSource source = new ByteArrayDataSource(bytes, type);
-
 
123
    	messageBodyPart.setDataHandler(new DataHandler(source));
-
 
124
    	messageBodyPart.setFileName(filename);
-
 
125
    	multipart.addBodyPart(messageBodyPart);
-
 
126
    	
-
 
127
    	// Put parts in message
-
 
128
    	msg.setContent(multipart);
-
 
129
    	Transport.send(msg);
-
 
130
    }
-
 
131
 
-
 
132
    public void sendSSLMessage(String recipients[], String subject, String message, final String from, final String password, List<File> files) throws MessagingException {
108
    public void sendSSLMessage(String recipients[], String subject, String message, final String from, final String password, List<File> files) throws MessagingException {
133
        try {
109
        try {
134
            Message msg = prepareMessage(recipients, subject, from, password);
110
            Message msg = prepareMessage(recipients, subject, from, password);
135
            
111
            
136
            //Create the multi-part object to hold the text and attachment parts
112
            //Create the multi-part object to hold the text and attachment parts