diff -crN dansguardian-2.9.8.1.orig/src/FOptionContainer.cpp dansguardian-2.9.8.1/src/FOptionContainer.cpp
*** dansguardian-2.9.8.1.orig/src/FOptionContainer.cpp	2006-11-29 21:03:48.000000000 +0900
--- dansguardian-2.9.8.1/src/FOptionContainer.cpp	2006-12-27 08:19:36.000000000 +0900
***************
*** 312,317 ****
--- 312,324 ----
  			syslog(LOG_ERR, "contentsubject cannot be blank while usesmtp is on.");
  			return false;
  		}
+ 		charset = findoptionS("charset");
+ 		if (charset.length()==0 && use_smtp) {
+ 			if (!is_daemonised)
+ 				std::cerr << "charset cannot be blank while usesmtp is on." << std::endl;
+ 			syslog(LOG_ERR, "charset cannot be blank while usesmtp is on.");
+ 			return false;
+ 		}
  #endif
  	   
  		// override default reporting level
diff -crN dansguardian-2.9.8.1.orig/src/FOptionContainer.hpp dansguardian-2.9.8.1/src/FOptionContainer.hpp
*** dansguardian-2.9.8.1.orig/src/FOptionContainer.hpp	2006-05-26 17:46:49.000000000 +0900
--- dansguardian-2.9.8.1/src/FOptionContainer.hpp	2006-12-27 08:16:45.000000000 +0900
***************
*** 176,181 ****
--- 176,182 ----
  	std::string contentadmin;   
  	std::string avsubject;
  	std::string contentsubject;   
+ 	std::string charset;
  	std::string violationbody;
  #endif
     
diff -crN dansguardian-2.9.8.1.orig/src/FatController.cpp dansguardian-2.9.8.1/src/FatController.cpp
*** dansguardian-2.9.8.1.orig/src/FatController.cpp	2006-11-27 21:08:55.000000000 +0900
--- dansguardian-2.9.8.1/src/FatController.cpp	2006-12-27 10:44:38.000000000 +0900
***************
*** 1256,1263 ****
  							fprintf(mail, "To: %s\n", o.fg[filtergroup]->avadmin.c_str());
  							fprintf(mail, "From: %s\n", o.fg[filtergroup]->mailfrom.c_str());
  							fprintf(mail, "Subject: %s\n", o.fg[filtergroup]->avsubject.c_str());
  							fprintf(mail, "A virus was detected by DansGuardian.\n\n");
! 							fprintf(mail, "%-10s%s\n", "Data/Time:", when.c_str());
  							if (who != "-")
  								fprintf(mail, "%-10s%s\n", "User:", who.c_str());
  							fprintf(mail, "%-10s%s (%s)\n", "From:", from.c_str(),  ((clienthost.length() > 0) ? clienthost.c_str() : "-"));
--- 1256,1265 ----
  							fprintf(mail, "To: %s\n", o.fg[filtergroup]->avadmin.c_str());
  							fprintf(mail, "From: %s\n", o.fg[filtergroup]->mailfrom.c_str());
  							fprintf(mail, "Subject: %s\n", o.fg[filtergroup]->avsubject.c_str());
+ 							fprintf(mail, "Content-Type: text/plain; charset=%s\n", o.fg[filtergroup]->charset.c_str());
  							fprintf(mail, "A virus was detected by DansGuardian.\n\n");
! 							if (when != "")
! 								fprintf(mail, "%-10s%s\n", "Date/Time:", when.c_str());
  							if (who != "-")
  								fprintf(mail, "%-10s%s\n", "User:", who.c_str());
  							fprintf(mail, "%-10s%s (%s)\n", "From:", from.c_str(),  ((clienthost.length() > 0) ? clienthost.c_str() : "-"));
***************
*** 1307,1314 ****
  						o.fg[filtergroup]->current_violations++;
  
  					// construct email report
! 					sprintf(vbody_temp, "%-10s%s\n", "Data/Time:", when.c_str());
! 					vbody+=vbody_temp;
  
  					if ((!byuser) && (who != "-")) {
  						sprintf(vbody_temp, "%-10s%s\n", "User:", who.c_str());
--- 1309,1318 ----
  						o.fg[filtergroup]->current_violations++;
  
  					// construct email report
! 					if (when != "") {
! 						sprintf(vbody_temp, "%-10s%s\n", "Date/Time:", when.c_str());
! 						vbody+=vbody_temp;
! 					}
  
  					if ((!byuser) && (who != "-")) {
  						sprintf(vbody_temp, "%-10s%s\n", "User:", who.c_str());
***************
*** 1366,1371 ****
--- 1370,1376 ----
  									else
  										fprintf(mail, "Subject: %s\n", o.fg[filtergroup]->contentsubject.c_str());
  
+ 									fprintf(mail, "Content-Type: text/plain; charset=%s\n", o.fg[filtergroup]->charset.c_str());
  									fprintf(mail, "%i violation%s ha%s occured within %i seconds.\n",
  										curv_tmp,
  										(curv_tmp==1)?"":"s",
diff -crN dansguardian-2.9.8.1.orig/src/contentscanners/clamav.cpp dansguardian-2.9.8.1/src/contentscanners/clamav.cpp
*** dansguardian-2.9.8.1.orig/src/contentscanners/clamav.cpp	2006-01-24 01:06:49.000000000 +0900
--- dansguardian-2.9.8.1/src/contentscanners/clamav.cpp	2006-12-27 10:32:16.000000000 +0900
***************
*** 123,129 ****
  #ifdef __CLAMAV_SHM
  	if (use_shm) {
  		// use POSIX shared memory to get the FD
! 		fname = tmpnam(NULL);
  		fname = fname.substr(fname.find_last_of('/'));
  		fd = shm_open(fname.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
  	} else {
--- 123,130 ----
  #ifdef __CLAMAV_SHM
  	if (use_shm) {
  		// use POSIX shared memory to get the FD
! 		/*fname = tmpnam(NULL);*/
! 		fname = mkstemp(NULL);
  		fname = fname.substr(fname.find_last_of('/'));
  		fd = shm_open(fname.c_str(), O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
  	} else {
