String username=request.getParameter("login"); String passwort=request.getParameter("password"); Sitzung session2=Session.getInstance(System.getProperties(),null); Store store=session2.getStore("pop3"); |
versuchen{ store.connect(host,username+"%nyist.net", Passwort); } Catch(javax.mail.AuthenticationFailedException e) {content="Benutzername und Passwort stimmen nicht überein";} |
store.connect("nyist.net",-1,request.getParameter("username")+"%nyist.net",request .getParameter("Passwort")); |
Ordnerfolder = store.getFolder("INBOX"); Folder.open (Folder.READ_WRITE); Nachricht message[]=folder.getMessages(); FetchProfile fp=new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE); fp.add(FetchProfile.Item.FLAGS); fp.add("X-Mailer"); Ordner.fetch(Nachricht,fp); |
String contentbody=""; Objekt o=message[j].getContent(); |
if (message[j].isMimeType("text/plain")) { contentbody=(String)+"</td>"; StringBuffer buf=new StringBuffer(contentbody.length()+6); char ch=''; for(int p=0;p<contentbody.length();p++)//Wenn ein Zeilenumbruch auftritt, konvertieren Sie ihn in <br> {ch=contentbody.charAt(p); if(ch=='n')buf.append("<br>"); sonst buf.append(ch); } contentbody=buf.toString(); } |
else if (message[j].isMimeType("text/html")) contentbody=(String)o+"</td>"; |
String host = "nyist.net"; String from = request.getParameter("from"); String to = request.getParameter("to"); String subject = request.getParameter("subject"); String-Inhalt = request.getParameter("content"); Eigenschaften props = System.getProperties(); //Mail-Dienst festlegen props.put("mail.smtp.host", host); Sitzung session2 =Session.getInstance(props, null); |
MimeMessage-Nachricht =new MimeMessage(session2); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO,new InternetAddress(to)); message.setSubject(subject); message.setSentDate(new Date()); // den Nachrichtenteil erstellen MimeBodyPart messageBodyPart =new MimeBodyPart(); |
messageBodyPart.setText(content); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messageBodyPart); |
for (int i=0;i<mySmartUpload.getFiles().getCount();i++) { com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i); if (!myFile.isMissing()) { myFile.saveAs("/upload/" + myFile.getFileName()); count++; } |
for(int i=0;request.getParameter("file"+i)!=null;i++) { messageBodyPart = new MimeBodyPart(); Datei file=new File("/home/mengyu/ROOT/upload/",request.getParameter("file"+i)); DataSource source =new FileDataSource(file); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(request.getParameter("file"+i)); multipart.addBodyPart(messageBodyPart); } // Teile in Nachricht einfügen message.setContent(multipart); |
Transport.send(Nachricht); |
Ordnerfolder=store.getFolder("INBOX"); Ordner.open(Ordner.READ_WRITE); Nachricht message[]=folder.getMessages(); String msg[]=request.getParameterValues("msg"); for(int i=0,n=msg.length;i<n;i++) message[Double.valueOf(msg[i]).intValue()].setFlag(Flags.Flag.DELETED,true); Ordner.close(true); |
//Add userRuntime.getRuntime().exec("/home/vpopmail/bin/vadduser"+request.getParameter("user name")+"@nyist.net "+request.getParameter("passwd")); //Delete userRuntime.getRuntime().exec("/home/vpopmail/bin/vdeluser"+request.getParameter("user Name")+"@nyist.net"); //Benutzerpasswort ändern Runtime.getRuntime().exec("/home/vpopmail/bin/vpasswd"+request.getParameter("usern ame")+"@nyist.net "+request.getParameter("passwd")); |