本文整理汇总了C++中MailMessage::Attach方法的典型用法代码示例。如果您正苦于以下问题:C++ MailMessage::Attach方法的具体用法?C++ MailMessage::Attach怎么用?C++ MailMessage::Attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailMessage
的用法示例。
在下文中一共展示了MailMessage::Attach方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: message
OsStatus
NotificationHelper::send (
const UtlString& rMailboxIdentity,
const UtlString& rSMTPServer,
const Url& mailboxServiceUrl,
const UtlString& rContact,
const UtlString& rFrom,
const UtlString& rReplyTo,
const UtlString& rDate,
const UtlString& rDurationMSecs,
const UtlString& wavFileName,
const char* pAudioData,
const int& rAudioDatasize,
const UtlBoolean& rAttachmentEnabled) const
{
OsStatus status = OS_SUCCESS;
// For forwarded messages, duration = aggregate of duration of different
// messages that make up the forwarded message.
// Skip duration for forwarded messages in this release (1.1).
UtlString durationText = "" ;
if( !wavFileName.contains("-FW") )
{
durationText += "Duration " ;
int iDuration = atoi(rDurationMSecs);
if( iDuration > 0 )
{
// Convert to seconds
iDuration = iDuration / 1000;
char temp[10];
if( iDuration >= 3600 )
{
// Retrieve the hour.
int hours = iDuration / 3600 ;
iDuration = iDuration - (hours * 3600);
sprintf( temp, "%02d", hours );
durationText = UtlString( temp ) + ":" ;
}
if( iDuration >= 60 )
{
// 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" +
//.........这里部分代码省略.........