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


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

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


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

示例1: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    a.setApplicationName("Jupiter Reporter");
    a.setOrganizationName("XE-QT Solutions");
    a.setOrganizationDomain("xe-qt-solutions.com");

    QxtCommandOptions options;
    options.add("version", "show version number and build date");
    options.alias("version", "ver");
    options.add("help", "show this help text");

    options.addSection("printing and PDF");
    options.add("print", "print a report to a specific printer (blank for default)", QxtCommandOptions::ValueOptional);
    options.add("pdf", "save a report as a PDF file", QxtCommandOptions::ValueRequired);

    options.addSection("email");
    options.add("to", "list of email recipients", QxtCommandOptions::ValueRequired);
    options.add("cc", "list of email cc recipients", QxtCommandOptions::ValueRequired);
    options.add("subject", "the email subject", QxtCommandOptions::ValueRequired);
    options.add("body", "the body of the email message", QxtCommandOptions::ValueRequired);
    options.add("server", "the email smtp server", QxtCommandOptions::ValueRequired);
    options.add("port", "the smtp server port", QxtCommandOptions::ValueRequired);
    options.add("ssl", "use a secure socket when sending email");
    options.add("account", "the name of the smtp account", QxtCommandOptions::ValueRequired);
    options.add("password", "the smtp account password", QxtCommandOptions::ValueRequired);
    options.add("from", "the email address of the email sender", QxtCommandOptions::ValueRequired);

    options.addSection("licensing");
    options.add("lic", "display license details");
    options.add("name", "the licensee name", QxtCommandOptions::ValueRequired);
    options.add("email", "the licensee email address", QxtCommandOptions::ValueRequired);
    options.add("expires", "the license expiry date (YYYY-MM-DD format)", QxtCommandOptions::ValueRequired);
    options.add("key", "the activation key to unlock advanced features", QxtCommandOptions::ValueRequired);
    options.parse(a.arguments());

    if (options.count("version"))
    {
	std::cout << "Jupiter Reporter v" << VER_MAJOR << "." << VER_MINOR << ", built on " << __DATE__ << " at " << __TIME__ << std::endl;
	std::cout << "Copyright (c) 2010 XE-QT Solutions Ltd., All rights reserved." << std::endl;
	return 0;
    }

    QSettings settings(QString("%1/license.ini").arg(QDesktopServices::storageLocation(QDesktopServices::DataLocation)), QSettings::IniFormat);

    // Generate license?
    if (options.count("name") || options.count("email") || options.count("expires"))
    {
	const QString name = options.value("name").toString();
	const QString email = options.value("email").toString();
	const QString expires = options.value("expires").toString();

	if (name.isEmpty() || email.isEmpty() || expires.isEmpty())
	{
	    options.showUsage();
	    return 0;
	}

	settings.setValue("License/name", name);
	settings.setValue("License/email", email);
	settings.setValue("License/expires", expires);
	settings.setValue("License/license", NodeLockedLicense::licenseFile(name, email, QDate::fromString(expires, Qt::ISODate)));

	std::cout << "Generated " << qPrintable(settings.fileName()) << std::endl;

	return 0;
    }

    if (options.count("key"))
    {
	settings.setValue("License/key", options.value("key").toString());
	settings.remove("License/license");
	std::cout << "Updated " << qPrintable(settings.fileName()) << std::endl;
	return 0;
    }

    // Read license
    const QString name = settings.value("License/name").toString();
    const QString email = settings.value("License/email").toString();
    const QDate expires = QDate::fromString(settings.value("License/expires").toString(), Qt::ISODate);
    const QString key = settings.value("License/key").toString();

    bool isLicensed = NodeLockedLicense::isValid(name, email, expires, key);

    if (options.count("lic"))
    {
	std::cout << "License: " << qPrintable(settings.fileName()) << std::endl;

	if (!isLicensed)
	{
	    std::cout << "No valid license exists.  Advanced functionality will be disabled." << std::endl;
	}
	else
	{
	    std::cout << "Licensed to " << qPrintable(name) << " (" << qPrintable(email) << "), expires on " << qPrintable(expires.toString()) << std::endl;
	}
	return 0;
    }

//.........这里部分代码省略.........
开发者ID:robcaldecott,项目名称:jupiter,代码行数:101,代码来源:main.cpp


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