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


C++ MailMessage::Subject方法代码示例

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


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

示例1: Eq

TEST_F(ReportMailerTest, CanConstructMailMessage)
{
    string toAddress = "[email protected]";
    StubReport report;

    MailMessage message = ReportMailer::ConstructMailMessageTo(toAddress, &report);

    ASSERT_THAT(message.To()[0], Eq(toAddress));
    ASSERT_THAT(message.Subject(), Eq(report.Name()));
    ASSERT_THAT(message.Content(), Eq(report.Text()));
    ASSERT_THAT(message.From(), Eq("[email protected]"));
}
开发者ID:nstoker,项目名称:mcpp-tdd,代码行数:12,代码来源:ReportMailerTest.cpp

示例2: message


//.........这里部分代码省略.........
                        {
                                // Retrieve the hour.
                                int mins = iDuration / 60  ;
                                iDuration = iDuration - (mins * 60);
                                sprintf( temp, "%02d", mins );

                                durationText += UtlString( temp ) + ":" ;
                        }
                        else
                        {
                                durationText += "00:" ;
                        }

                        // append the seconds
                        sprintf( temp, "%02d", iDuration );
                        durationText += temp;
        }
        else
        {
            durationText = UtlString("00:00") ;
        }
    }

    UtlString strFrom = "Unknown" ;
    if( !rFrom.isNull() && rFrom.length() > 0)
        strFrom = rFrom ;
    UtlString subject = "New Voicemail from " + strFrom ;

    UtlString rawMessageId = wavFileName(0, wavFileName.first('-'));
    UtlString userId = rMailboxIdentity(0, rMailboxIdentity.first('@'));

    UtlString plainBodyText, htmlBodyText;

    MailMessage message ( "Voicemail Notification Service", rReplyTo, rSMTPServer );

    UtlString baseMailboxLink = mailboxServiceUrl.toString();
    baseMailboxLink.append("/").append(userId).append("/inbox");

    UtlString playMessageLink = baseMailboxLink;
    playMessageLink.append("/").append(rawMessageId);
    UtlString deleteMessageLink = baseMailboxLink;
    deleteMessageLink.append("/").append(rawMessageId).append("/delete");
    UtlString showMailboxLink = baseMailboxLink;

    plainBodyText += "On " + rDate + ", " + strFrom + " left new voicemail. " +
        durationText + "\n";
    plainBodyText += "Listen to message " + playMessageLink + "\n";
    plainBodyText += "Show Voicemail Inbox "   + showMailboxLink + "\n";
    plainBodyText += "Delete message " + deleteMessageLink + "\n";

    UtlString playMessageLinkXml ;
    UtlString deleteMessageLinkXml;
    UtlString showMailboxLinkXml;
    XmlEscape(playMessageLinkXml, playMessageLink) ;
    XmlEscape(deleteMessageLinkXml, deleteMessageLink) ;
    XmlEscape(showMailboxLinkXml, showMailboxLink) ;
    // Format the html text if supported by the browser
    htmlBodyText =
        (UtlString)"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n" +
                  "   \"http://www.w3.org/TR/html4/strict.dtd\">\n" +
                  "<HTML>\n" +
                  "<HEAD>\n" +
                  "<TITLE>Voicemail Notification</TITLE>\n" +
                  "</HEAD>\n<BODY>\n";
    htmlBodyText +=
        "<p>On " + rDate + ", " + strFrom + " left new voicemail. " +
        durationText + "</p>\n";
    htmlBodyText +=
        "<p><a href=\"" + playMessageLinkXml + "\">Listen to message</a></p>\n";
    htmlBodyText +=
        "<p><a href=\"" + showMailboxLinkXml + "\">Show Voicemail Inbox</a></p>\n";
    htmlBodyText +=
        "<p><a href=\"" + deleteMessageLinkXml + "\">Delete message</a></p>\n";
    htmlBodyText +=
        (UtlString)"</BODY>\n" +
                                  "</HTML>\n";

    if ( rAttachmentEnabled == TRUE )
    {
        unsigned char* unsignedAudioData = (unsigned char*) pAudioData;
        message.Attach( unsignedAudioData, rAudioDatasize, wavFileName);
    }

    message.Body( plainBodyText , htmlBodyText );
    message.Subject( subject );
    message.To( rContact, rContact );
    UtlString response = message.Send();
    if ( !response.isNull() )
    {
        if( response.length() > 0 )
        {
            OsSysLog::add(FAC_MEDIASERVER_CGI, PRI_ERR,
                          "NotificationHelper: "
                          "Error sending e-mail to '%s' via SMTP server '%s'\n    %s",
                          rContact.data(), rSMTPServer.data(), response.data());
            OsSysLog::flush();
        }
    }
    return status;
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:101,代码来源:NotificationHelper.cpp


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