////////////////////////////////////////////////////////////////////////// Check to make sure the message is adequately defined and send it.
| 70 | // Check to make sure the message is adequately defined and send it. |
| 71 | // |
| 72 | bool cPipedMailMessage::Send() |
| 73 | { |
| 74 | // Be sure that everything that needs to be set has been set |
| 75 | if (!Ready()) |
| 76 | { |
| 77 | // the message has not been adequately defined and cannot be sent. |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | SendInit(); |
| 82 | |
| 83 | ASSERT(mpFile != 0); |
| 84 | //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 85 | // Get Body and Attachments |
| 86 | //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 87 | |
| 88 | // get body |
| 89 | std::string sNBody = cStringUtil::TstrToStr(mstrBody); |
| 90 | |
| 91 | // get attachments |
| 92 | std::string sAttachments; |
| 93 | if (!GetAttachmentsAsString(sAttachments)) |
| 94 | { |
| 95 | sAttachments.erase(); |
| 96 | } |
| 97 | |
| 98 | std::string sSend = sNBody + sAttachments; |
| 99 | |
| 100 | |
| 101 | //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 102 | // Make sure that there's no lone LFs |
| 103 | //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 104 | |
| 105 | cMailMessageUtil::LFToCRLF(sSend); |
| 106 | |
| 107 | //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 108 | // Determine encoding needed for body or attachments |
| 109 | //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 110 | |
| 111 | std::string sContentType = "Content-Transfer-Encoding: "; |
| 112 | |
| 113 | if (cMailMessageUtil::HasNonAsciiChars(sSend)) |
| 114 | { |
| 115 | // encode text |
| 116 | sSend = iMimeEncoding::GetInstance()->Encode(sSend, cMailMessageUtil::_MAX_RFC822_LINE_LEN); |
| 117 | |
| 118 | // identify content type |
| 119 | sContentType += iMimeEncoding::GetInstance()->GetContentTypeIdentifier(); |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | // do no encoding |
| 124 | |
| 125 | // identify content type |
| 126 | sContentType += "7bit"; |
| 127 | } |
| 128 | |
| 129 | // send content type |
nothing calls this directly
no test coverage detected