把jpg图像读到内存,压缩后发送...

解决方案 »

  1.   

    CSMTPConnection conn;
    if(!conn.Connect("smtp.126.com",25,"yinzhaohui_2005","123456"))
    {
    MessageBox("连接邮件服务smtp.126.com器失败,或认证失败");
    return 0;
    }
    CMimeMessage msg;
    msg.SetSender(_T("[email protected]"));
    msg.AddRecipient(_T("[email protected]"));
    msg.SetSubject(_T("崩溃处理"));
    msg.SetPriority(ATL_MIME_NORMAL_PRIORITY);
    TCHAR info[2048]={0};
    m_etMailContent.GetWindowText(info,2048);
    msg.AddText(info);
    if(m_fileSize!=0)
    {
    TCHAR *buffer=new TCHAR[m_fileSize];
    m_etCrashContent.GetWindowText(buffer,m_fileSize);
    msg.AddText(buffer);
    delete []buffer;
    }
    TCHAR dmpFilePath[1024];
    _tcscpy(dmpFilePath,m_szCrashInfoPath.c_str());
    ::PathAppend(dmpFilePath,m_szProgramName.c_str());
    ::PathAddExtension(dmpFilePath,_T(".DMP"));
    msg.AttachFile(dmpFilePath,::PathFindFileName(dmpFilePath),"application/octet-stream");
    if(conn.SendMessage(msg))
    MessageBox("邮件发送成功!");
    else
    MessageBox("邮件发送失败!");
    return 0;