• 大小: 1.89MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-31
  • 语言: C/C++
  • 标签: vc++  收发邮件  

资源简介

vc++做的邮件收发系统,供课程设计使用。仅供参考

资源截图

代码片段和文件信息

// MailMessage.cpp: implementation of the CMailMessage class.
// Copyright (c) 1998 Wes Clyburn
// Download by http://www.codefans.net
// Modified to have Header and Body handling in this class rather than in any
// class that uses instances of CMailMessage.
// Copyright (c) 1998 Michael Krebs
//////////////////////////////////////////////////////////////////////

#include “stdafx.h“
#include “MailMessage.h“

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMailMessage::CMailMessage()
{
m_sBody=_T(““);
m_sHeader=_T(““);
}

CMailMessage::~CMailMessage()
{

}

BOOL CMailMessage::AddRecipient( LPCTSTR szEmailAddress LPCTSTR szFriendlyName)
{
ASSERT( szEmailAddress != NULL );
ASSERT( szFriendlyName != NULL );
CRecipient to;
to.m_sEmailAddress = szEmailAddress;
to.m_sFriendlyName = szFriendlyName;
m_Recipients.Add( to );
return TRUE;
}

// sEmailAddress and sFriendlyName are OUTPUT parameters.
// If the function fails it will return FALSE and the OUTPUT
// parameters will not be touched.
BOOL CMailMessage::GetRecipient(CString & sEmailAddress CString & sFriendlyName int nIndex)
{
CRecipient to;
if( nIndex < 0 || nIndex > m_Recipients.GetUpperBound() )
return FALSE;
to = m_Recipients[ nIndex ];
sEmailAddress = to.m_sEmailAddress;
sFriendlyName = to.m_sFriendlyName;
return TRUE;
}

int CMailMessage::GetNumRecipients()
{
return m_Recipients.GetSize();
}

BOOL CMailMessage::AddMultipleRecipients(LPCTSTR szRecipients )
{
TCHAR* buf;
UINT pos;
UINT start;
CString sTemp;
CString sEmail;
CString sFriendly;
UINT length;
int nMark;
int nMark2;

ASSERT( szRecipients != NULL );

// Add Recipients
//
length = strlen( szRecipients );
buf = new TCHAR[ length + 1 ]; // Allocate a work area (don‘t touch parameter itself)
strcpy( buf szRecipients );
for( pos = 0 start = 0; pos <= length; pos++ )
{
if( buf[ pos ] == ‘;‘ ||
buf[ pos ] == 0 )
{
// First pick apart the sub-strings (separated by ‘;‘)
//  Store it in sTemp.
//
buf[ pos ] = 0; // Redundant when at the end of string but who cares.
sTemp = &buf[ start ];

// Now divide the substring into friendly names and e-mail addresses.
//
nMark = sTemp.Find( ‘<‘ );
if( nMark >= 0 )
{
sFriendly = sTemp.Left( nMark );
nMark2 = sTemp.Find( ‘>‘ );
if( nMark2 < nMark )
{
delete[] buf;
return FALSE;
}
// End of mark at closing bracket or end of string
nMark2 > -1 ? nMark2 = nMark2 : nMark2 = sTemp.GetLength() - 1;
sEmail = sTemp.Mid( nMark + 1 nMark2 - (nMark + 1) );
}
else
{
sEmail = sTemp;
sFriendly = ““;
}
AddRecipient( sEmail sFriendly );
start = pos 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      57283  2014-06-18 18:46  收发送电子邮件\MyEmailClient\Debug\MailMessage.obj

     文件     139354  2014-06-18 18:59  收发送电子邮件\MyEmailClient\Debug\MyEmailClient.exe

     文件     281880  2014-06-18 18:59  收发送电子邮件\MyEmailClient\Debug\MyEmailClient.ilk

     文件      15942  2014-06-18 18:46  收发送电子邮件\MyEmailClient\Debug\MyEmailClient.obj

     文件    5567268  2014-06-18 18:46  收发送电子邮件\MyEmailClient\Debug\MyEmailClient.pch

     文件     443392  2014-06-18 18:59  收发送电子邮件\MyEmailClient\Debug\MyEmailClient.pdb

     文件       3284  2014-06-18 18:59  收发送电子邮件\MyEmailClient\Debug\MyEmailClient.res

     文件      37620  2014-06-18 18:58  收发送电子邮件\MyEmailClient\Debug\MyEmailClientDlg.obj

     文件      33078  2014-06-18 18:46  收发送电子邮件\MyEmailClient\Debug\POP3.obj

     文件      29757  2014-06-18 18:46  收发送电子邮件\MyEmailClient\Debug\SMTP.obj

     文件     106729  2014-06-18 18:46  收发送电子邮件\MyEmailClient\Debug\StdAfx.obj

     文件     222208  2014-06-18 18:59  收发送电子邮件\MyEmailClient\Debug\vc60.idb

     文件     364544  2014-06-18 18:58  收发送电子邮件\MyEmailClient\Debug\vc60.pdb

     文件       7400  2010-04-16 21:48  收发送电子邮件\MyEmailClient\MailMessage.cpp

     文件       1541  1998-11-30 02:07  收发送电子邮件\MyEmailClient\MailMessage.h

     文件      37136  2014-06-18 18:59  收发送电子邮件\MyEmailClient\MyEmailClient.aps

     文件       1872  2014-06-18 19:04  收发送电子邮件\MyEmailClient\MyEmailClient.clw

     文件       2255  2002-06-27 08:46  收发送电子邮件\MyEmailClient\MyEmailClient.cpp

     文件       4659  2002-06-27 09:50  收发送电子邮件\MyEmailClient\MyEmailClient.dsp

     文件        551  2002-06-27 08:46  收发送电子邮件\MyEmailClient\MyEmailClient.dsw

     文件       1437  2010-04-16 21:53  收发送电子邮件\MyEmailClient\MyEmailClient.h

     文件      66560  2014-06-18 19:04  收发送电子邮件\MyEmailClient\MyEmailClient.ncb

     文件      53760  2014-06-18 19:04  收发送电子邮件\MyEmailClient\MyEmailClient.opt

     文件        987  2014-06-18 18:59  收发送电子邮件\MyEmailClient\MyEmailClient.plg

     文件       6477  2014-06-18 18:59  收发送电子邮件\MyEmailClient\MyEmailClient.rc

     文件       6258  2014-06-18 19:04  收发送电子邮件\MyEmailClient\MyEmailClientDlg.cpp

     文件       1563  2002-06-27 09:10  收发送电子邮件\MyEmailClient\MyEmailClientDlg.h

     文件       5342  2010-04-16 21:53  收发送电子邮件\MyEmailClient\POP3.cpp

     文件       1760  1998-11-29 04:50  收发送电子邮件\MyEmailClient\POP3.h

     文件       3705  2002-06-27 08:46  收发送电子邮件\MyEmailClient\ReadMe.txt

............此处省略14个文件信息

评论

共有 条评论