📄 smtp.htm
字号:
<p><a href="#Disconnect"><font face="Arial">CSMTPConnection::SendMessage</font></a></p>
<p> </p>
<p> </p>
<p> </p>
<p><a name="Attach"></a><big><font face="Arial"><strong>CSMTPAttachment::Attach</strong></font></big></p>
<p><font face="Arial"><strong>BOOL Attach(const CString& </strong><em>sFilename</em><strong>);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">TRUE if the file was successfully encoded as an attachment
otherwise FALSE.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>sFilename</em> A reference to the name of the file to setup as
an attachment.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Internally this function will perform a base64 encoding of the
specified file and store the encoding in a private buffer ready for use when this
attachment is associated with an SMTP message.</font></p>
<p><font face="Arial"><strong>See Also</strong></font></p>
<p><a href="#AddAttachment"><font face="Arial">CSMTPMessage::AddAttachment</font></a></p>
<p> </p>
<p> </p>
<p><a name="GetFilename"></a><big><font face="Arial"><strong>CSMTPAttachment::GetFilename</strong></font></big></p>
<p><font face="Arial"><strong>CString GetFilename() const;</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">Returns the name of the file this attachment represents</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial">None</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">This will return just the "filename.ext" form of the
filename. e.g. if you called Attach with the filename "c:\autoexec.bat", the
return value from GetFilename will be "autoexec.bat".</font></p>
<p> </p>
<p> </p>
<p><a name="GetEncodedBuffer"></a><big><font face="Arial"><strong>CSMTPAttachment::GetEncodedBuffer</strong></font></big></p>
<p><font face="Arial"><strong>const char* GetEncodedBuffer() const;</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">Returns the base64 encoded representation of the
attachment</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial">None</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">None</font></p>
<p> </p>
<p><font face="Arial"><strong><big><a name="SetTitle"></a>CSMTPAttachment::SetTitle</big></strong></font></p>
<p><font face="Arial"><strong>void SetTitle(const CString& sTitle);</strong></font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><i>sTitle</i> The new title of the file attachment</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Allows you to change the name of the attachment as it will appear in
the email. By default it will be the filename of the file you add. Examples where this are
useful are if you save a file to a temporary filename on your machine prior to emailing it
to someone.</font></p>
<p><font face="Arial"><strong>See Also</strong></font></p>
<p><a href="#GetTitle"><font face="Arial">CSMTPMessage::GetTitle</font></a></p>
<p> </p>
<p><font face="Arial"><strong><big><a name="GetTitle"></a>CSMTPAttachment::GetTitle</big></strong></font></p>
<p><font face="Arial"><strong>CString GetTitle() const;</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">The name of the attchement as it will appear in the email</font></p>
<p><font face="Arial"><strong>See Also</strong></font></p>
<p><a href="#SetTitle"><font face="Arial">CSMTPMessage::SetTitle</font></a></p>
<p> </p>
<p><a name="AddRecipient"></a><big><strong><font face="Arial">CSMTPMessage::AddRecipient</font></strong></big></p>
<p><font face="Arial"><strong>int AddRecipient(CSMTPAddress& </strong><em>recipient</em><strong>,
RECIPIENT_TYPE </strong><em>RecipientType</em><strong> = TO);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">The index of the newly added recipient to the message.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>recipient</em> A reference to the recipient to add to this
message.</font></p>
<p><font face="Arial"><em>RecipientType</em> The type of recipient to add. RECIPIENT_TYPE
is an enum with the following three values: TO, CC & BCC</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Adds a recipient of the specified type to a message. This would
normally be called at least once, prior to sending an email message.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#RemoveRecipient"><font face="Arial">CSMTPMessage::RemoveRecipient</font></a></p>
<p> </p>
<p> </p>
<p><a name="RemoveRecipient"></a><big><strong><font face="Arial">CSMTPMessage::RemoveRecipient</font></strong></big></p>
<p><font face="Arial"><strong>void RemoveRecipient(int </strong><em>nIndex</em><strong>,
RECIPIENT_TYPE </strong><em>RecipientType</em><strong> = TO);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">None.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>nIndex</em> The index of the recipient to remove.</font></p>
<p><font face="Arial"><em>RecipientType</em> The type of recipient "nIndex"
refers to. RECIPIENT_TYPE is an enum with the following three values: TO, CC & BCC</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">The corollary function of AddRecipient.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#AddRecipient"><font face="Arial">CSMTPMessage::AddRecipient</font></a></p>
<p> </p>
<p> </p>
<p><a name="GetRecipient"></a><big><strong><font face="Arial">CSMTPMessage::GetRecipient</font></strong></big></p>
<p><font face="Arial"><strong>CSMTPAddress GetRecipient(int </strong><em>nIndex</em><strong>,
RECIPIENT_TYPE </strong><em>RecipientType</em><strong> = TO) const;</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">The recipient at the specified offset.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>nIndex</em> The index of the recipient to retrieve.</font></p>
<p><font face="Arial"><em>RecipientType</em> The type of recipient "nIndex"
refers to. RECIPIENT_TYPE is an enum with the following three values: TO, CC & BCC</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Allows access to the array of recipients associated with a message.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#AddRecipient"><font face="Arial">CSMTPMessage::AddRecipient</font></a></p>
<p> </p>
<p> </p>
<p><a name="GetNumberOfRecipients"></a><big><strong><font face="Arial">CSMTPMessage::GetNumberOfRecipients</font></strong></big></p>
<p><font face="Arial"><strong>int GetNumberOfRecipients(RECIPIENT_TYPE </strong><em>RecipientType</em><strong>
= TO) const;</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">The number of recipients for this message.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>RecipientType</em> The type of recipients to retreive the size
for. RECIPIENT_TYPE is an enum with the following three values: TO, CC & BCC</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Returns the number of recipients this message is destined for.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#AddRecipient"><font face="Arial">CSMTPMessage::AddRecipient</font></a></p>
<p> </p>
<p> </p>
<p><a name="AddAttachment" href="#AddAttachment"></a><font face="Arial"><big><strong>CSMTPMessage::AddAttachment</strong></big></font></p>
<p><font face="Arial"><strong>int AddAttachment(CSMTPAttachment* </strong><em>pAttachment</em><strong>);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">The index of the newly added attachment to the message.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>pAttachment</em> A pointer to the file attachment to add to this
message.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Adds an attachment to a message. Please bear in mind that internally
a buffer will be allocated by this function and which is used while sending the
attachment. This means that the "attachment" instance must remain valid during
the lifetime of the call to CSMTPConnection::SendMessage</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><font face="Arial"><a href="#RemoveAttachment">CSMTPMessage::RemoveAttachment</a> <a
href="#Disconnect">CSMTPConnection::SendMessage</a></font></p>
<p> </p>
<p> </p>
<p><a name="RemoveAttachment"></a><big><strong><font face="Arial">CSMTPMessage::RemoveAttachment</font></strong></big></p>
<p><font face="Arial"><strong>void RemoveAttachment(int </strong><em>nIndex</em><strong>);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">None.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>nIndex</em> The index of the attachment to remove.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">The corollary function of AddAttachment.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#AddAttachment"><font face="Arial">CSMTPMessage::AddAttachment</font></a></p>
<p> </p>
<p> </p>
<p><a name="GetAttachment"></a><big><strong><font face="Arial">CSMTPMessage::GetAttachment</font></strong></big></p>
<p><font face="Arial"><strong>CSMTPAttachment* GetAttachment(int </strong><em>nIndex</em><strong>)
const;</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">A pointer to the attachment at the specified offset.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>nIndex</em> The index of the attachment to retrieve.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Allows access to the array of attachments associated with a message.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#AddAttachment"><font face="Arial">CSMTPMessage::AddAttachment</font></a></p>
<p> </p>
<p> </p>
<p><a name="GetNumberOfRecipients"></a><big><strong><font face="Arial">CSMTPMessage::GetNumberOfAttachments</font></strong></big></p>
<p><strong><font face="Arial">int GetNumberOfAttachments() const;</font></strong></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">The number of attachments for this message.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial">None.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Returns the number of attachments this message contains.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#AddAttachment"><font face="Arial">CSMTPMessage::AddAttachment</font></a></p>
<p> </p>
<p> </p>
<p><a name="m_From"></a><big><strong><font face="Arial">CSMTPMessage::m_From</font></strong></big></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">This is the address of the person from which the message is being
sent. You would normally set this value to your email address prior to sending a message.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -