For simple email sending encountered in the project, I put some parameter information in the mail. properties file. below is the file content read
Public static map getsystemmailcount (){
Map map = new hashmap ();
Inputstream = NULL;
Inputstream = new mailutil (). getclass (). getclassloader (). getresourceasstream ("mailconfig. properties ");
Properties prop = new properties ();
Try {
Prop. Load (inputstream );
String mailacount = prop. Get ("mailacount"). tostring ();
String mailpwd = prop. Get ("mailpwd"). tostring ();
String mailsmtp = prop. Get ("mailsmtp"). tostring ();
String mailtype = prop. Get ("mailtype"). tostring ();
String httpurl = prop. Get ("httpurl"). tostring ();
Map. Put ("mailacount", mailacount );
Map. Put ("mailpwd", mailpwd );
Map. Put ("mailsmtp", mailsmtp );
Map. Put ("mailtype", mailtype );
Map. Put ("httpurl", httpurl );
} Catch (ioexception e ){
E. printstacktrace ();
System. Out. println ("failed to read the mailbox configuration file! ");
}
Return map;
}
The code is relatively poor, but it is always able to read data, hoping to be useful to everyone. If you have a better way to operate, please contact us.