当前位置: 首页>>代码示例>>C++>>正文


C++ MailSender::send方法代码示例

本文整理汇总了C++中MailSender::send方法的典型用法代码示例。如果您正苦于以下问题:C++ MailSender::send方法的具体用法?C++ MailSender::send怎么用?C++ MailSender::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MailSender的用法示例。


在下文中一共展示了MailSender::send方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteCalibRequestFile

void ColorKeeperModel::deleteCalibRequestFile(string screenFullName,
		const unsigned int &screenIndex) {
	QFile calibRequestFile(
			QString::fromStdString(
					ColorKeeperModel::getCalibRequestFilePath(screenFullName)));
	if (calibRequestFile.exists()) {
		calibRequestFile.remove();
		const ILocalHost &host = ColorKeeperModel::Instance().getDeviceInfo();

		QString osName;
#ifdef __WIN32__
		osName = "Windows";
#endif
#ifdef __linux__
		osName = "Linux";
#endif
#ifdef __APPLE__
		osName = "MacOSX";
#endif

		QString hostname = QString(host.getHostName().c_str());
		QString domain = QString(host.getDomainName().c_str());
		bool isHighPriority = false;

		map<unsigned int, HealerCalibModel>::iterator calibIt =
				ColorKeeperModel::Instance()._calib.find(screenIndex);
		if (calibIt != ColorKeeperModel::Instance()._calib.end()) {
			isHighPriority = (*calibIt).second.isHighPriority();
		}

		MailSender* mailer = ColorKeeperModel::Instance().getMailer();
		if (mailer == NULL)
			return;

		//CalibRequest
		QString title = "CalibRequest For " + hostname + " on " + osName;
		if (isHighPriority)
			title = "URGENT " + title;
		QString message =
				"[CLOSED]\nMessage send by ColorKeeper after a calibration with ColorHealer.";
		mailer->send(QString::fromLocal8Bit(title.toStdString().c_str()),
				QString::fromLocal8Bit(message.toStdString().c_str()));

	}
}
开发者ID:caomw,项目名称:OpenDisplayCalib,代码行数:45,代码来源:ColorKeeperModel.cpp

示例2: sendAMailCalibrationRequest

void ColorKeeperModel::sendAMailCalibrationRequest() {

	MailSender* mailer = ColorKeeperModel::Instance().getMailer();
	if (mailer == NULL) {
		ostringstream os;
		os << "\nCoudn't find mailer configuration.\n" << endl;
		ColorKeeperModel::logMessage(os.str());
		return;
	}
	const ILocalHost &host = getDeviceInfo();
	const vector<unsigned int> & screenOrder = getScreenResOrder();
	QStringList screensToCalibrate;
	QStringList screensToCalibrateFullNames;
	bool isHighPriority = false;
	for (unsigned int i = 0; i < screenOrder.size(); i++) {
		const ZooperDisplayDevice & dispDev = host.getCalibrableDisplayDevice(
				screenOrder[i]);
		string fullname = dispDev.getFullName(false);
		if (isCalibResquestAsked(fullname)
				|| isScreenModelInvalidate(dispDev.getManufacturerName(),
						dispDev.getModelName()) || isMachineInvalidate())
			continue;
		int isHasBeen = isScreenCorrectionHasBeen(dispDev.getOSIndex());
		bool isNotCorrected = !isScreenCorrected(dispDev.getOSIndex());

		if (isHasBeen > 0) {
			QString message = "";
			message += "Average Priority : "
					+ QString(dispDev.getFullName().c_str()) + " has a "
					+ QString::number(isHasBeen)
					+ " days obsolete profile and need to be re-calibrate.";
			//			QString message = "";
			//			message
			//					+= "" + QString(
			//							dispDev.getFullName().c_str())
			//							+ " has no calibration profile and need to be calibrate very quickly.";

			screensToCalibrate << message;
			screensToCalibrateFullNames << QString::fromStdString(fullname);
		} else if (isNotCorrected) {
			QString message = "";
			message +=
					"High Priority : " + QString(dispDev.getFullName().c_str())
							+ " has no calibration profile and need to be calibrate very quickly.";

			screensToCalibrate << message;
			screensToCalibrateFullNames << QString::fromStdString(fullname);
			isHighPriority = true;
		}

	}

	int nbScreensToCalibrate = screensToCalibrate.size();
	if (nbScreensToCalibrate > 0) {

		QString osName;
#ifdef __WIN32__
		osName = "Windows";
#endif
#ifdef __linux__
		osName = "Linux";
#endif
#ifdef __APPLE__
		osName = "MacOSX";
#endif

		QString hostname = QString(host.getHostName().c_str());
		QString domain = QString(host.getDomainName().c_str());
		QString message =
				"Dear calibrators,\n\nColorKeeper has detected a lack of calibration for machine "
						+ hostname + " (domain : " + domain + ", user : "
						+ QString(host.getUserName().c_str()) + " ) on "
						+ osName + " : \n";
		//CalibRequest
		QString title = "CalibRequest For " + hostname + " on " + osName;
		if (isHighPriority)
			title = "URGENT " + title;

		for (int i = 0; i < nbScreensToCalibrate; i++) {
			message += "- " + screensToCalibrate.at(i) + "\n";
			ColorKeeperModel::createCalibRequestAskedFile(
					screensToCalibrateFullNames.at(i).toStdString(),
					message.toStdString());
		}
		message += "\nThanks !\n\n";

#ifdef __linux__
		message += "Reminder : on Linux, only one screen can be calibrated, ColorKeeper choose the primary screen in Nvidia-settings.\nSo when you're calibrating a dual screen linux station, check first that the primary screen if the best of the two (if not change the primary screen setting in Nivdia-settings).\n\n";
#endif

		mailer->send(QString::fromLocal8Bit(title.toStdString().c_str()),
				QString::fromLocal8Bit(message.toStdString().c_str()));

		ColorKeeperModel::logMessage("\nA request calib mail was sent.\n");

	}

}
开发者ID:caomw,项目名称:OpenDisplayCalib,代码行数:98,代码来源:ColorKeeperModel.cpp


注:本文中的MailSender::send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。