I am modifying the class CMimeMessage : public CMimeHeader, i need to modify the

<pre>
virtual inline BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary, LPCTSTR szFileName){ATLENSURE(szBoundary != NULL);ATLASSERT(szFileName != NULL);ATLASSUME(m_pszEncodeString != NULL);char szBegin[256];if (*szBoundary){// this is not the only body partChecked::memcpy_s(szBegin, 256, ATLMIME_SEPARATOR, sizeof(ATLMIME_SEPARATOR));Checked::memcpy_s(szBegin+6, 250, szBoundary, ATL_MIME_BOUNDARYLEN);*(szBegin+(ATL_MIME_BOUNDARYLEN+6)) = '\0';}else{// this is the only body part, so output the MIME headerChecked::memcpy_s(szBegin, 256, ATLMIME_VERSION, sizeof(ATLMIME_VERSION));}// Get file name with the path stripped outTCHAR szFile[MAX_PATH+1];TCHAR szExt[_MAX_EXT+1];Checked::tsplitpath_s(szFileName, NULL, 0, NULL, 0, szFile, _countof(szFile), szExt, _countof(szExt));Checked::tcscat_s(szFile, _countof(szFile), szExt);_ATLTRY{CT2CAEX szFileNameA(szFile);CStringA szDisplayName(szFile);if (m_szDisplayName[0] != '\0'){szDisplayName = CT2CAEX<_MAX_FNAME+1>(m_szDisplayName);}header.Format("%s\r\nContent-Type: %s;\r\n\tcharset=\"%s\"\r\n\tname=\"%s\"\r\n""Content-Transfer-Encoding: %s\r\nContent-Disposition: attachment;\r\n\tfilename=\"%s\"\r\n\r\n",szBegin, (LPCSTR) m_ContentType, m_szCharset, (LPCSTR) szDisplayName, m_pszEncodeString, (LPCSTR) szFileNameA); return TRUE;}_ATLCATCHALL(){return FALSE;}}
</pre>

to have an output:

Content-Type: image/jpeg; name="image003.jpg"
Content-Description: image003.jpg
Content-Disposition: inline; filename="image003.jpg"; size=2313;
creation-date="Wed, 01 Aug 2007 09:51:13 GMT";
modification-date="Wed, 01 Aug 2007 09:51:13 GMT"
Content-ID: <image003.jpg@01C7D464.924CE700>
Content-Transfer-Encoding: base64
instead of:
Content-Type: image/jpeg;
charset="Windows-1252"
name="image003.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="image003.jpg"


Ok my problem is when i am extracting and converting a .eml file to a new .eml file to convert the tnef i am having an issue getting the embedded attachments. When i get them instead of having them as embedded i just have them as a regular attachment due to the code by atlmime.h

Now my question is how can i get them back as embedded attachments, get their content-disposition and content ID? Thanks

The codes are from atlmime.h

apologies for the code above

class CExtMimeEmbed : public CMimeFileAttachment
{
public:
	CExtMimeEmbed(void)
	{}
	~CExtMimeEmbed(void)
	{}
protected:
	// the encode string ("base64", "quoted-printable", "uuencode")
	char     *m_pszEncodeString;
	
	TCHAR    m_szDisplayName[_MAX_FNAME];
	// the content type of the attachment
	CStringA m_ContentType;

	virtual inline BOOL MakeMimeHeader(CStringA& header, LPCSTR szBoundary, LPCTSTR szFileName) throw()
	{
		ATLENSURE(szBoundary != NULL);
		ATLASSERT(szFileName != NULL);
		ATLASSUME(m_pszEncodeString != NULL);

		char szBegin[256];
		if (*szBoundary)
		{
			// this is not the only body part
			Checked::memcpy_s(szBegin, 256, ATLMIME_SEPARATOR, sizeof(ATLMIME_SEPARATOR));
			Checked::memcpy_s(szBegin+6, 250, szBoundary, ATL_MIME_BOUNDARYLEN);
			*(szBegin+(ATL_MIME_BOUNDARYLEN+6)) = '\0';
		}
		else
		{
			// this is the only body part, so output the MIME header
			Checked::memcpy_s(szBegin, 256, ATLMIME_VERSION, sizeof(ATLMIME_VERSION));
		}

		// Get file name with the path stripped out
		TCHAR szFile[MAX_PATH+1];
		TCHAR szExt[_MAX_EXT+1];
		Checked::tsplitpath_s(szFileName, NULL, 0, NULL, 0, szFile, _countof(szFile), szExt, _countof(szExt));
		Checked::tcscat_s(szFile, _countof(szFile), szExt);

		_ATLTRY
		{
			CT2CAEX<MAX_PATH+1> szFileNameA(szFile);

			CStringA szDisplayName(szFile);
			if (m_szDisplayName[0] != '\0')
			{
				szDisplayName = CT2CAEX<_MAX_FNAME+1>(m_szDisplayName);
			}
			/*Content-Type: image/jpeg; name="image003.jpg"
			Content-Description: image003.jpg
			Content-Disposition: inline; filename="image003.jpg"; size=2313;
			creation-date="Wed, 01 Aug 2007 09:51:13 GMT";
			modification-date="Wed, 01 Aug 2007 09:51:13 GMT"
			Content-ID: <image003.jpg@01C7D464.924CE700>
			Content-Transfer-Encoding: base64*/

			/*Content-Type: image/jpeg;
			charset="Windows-1252"
			name="image003.jpg"
			Content-Transfer-Encoding: base64
			Content-Disposition: attachment;
			filename="image003.jpg"*/
			
			/*header.Format("%s\r\nContent-Type: %s;\"\r\n\tname=\"%s\"\r\n" "\r\nContent-Description: %s;\r\nContent-Disposition: inline;
				"\r\n\tfilename=\"%s\"\r\n\r\n" "\r\ncreation-date=\"%s" "\r\nmodification-date=\"%s" "\r\nContent-ID:\%s" "Content-Transfer-Encoding: %s",
				szBegin, (LPCSTR) m_ContentType, m_szCharset, (LPCSTR) szDisplayName, m_pszEncodeString, (LPCSTR) szFileNameA); */
			
			header.Format("%s\r\nContent-Type: %s;\r\n\tcharset=\"%s\"\r\n\tname=\"%s\"\r\n"
				"Content-Transfer-Encoding: %s\r\nContent-Disposition: inline;\r\n\tfilename=\"%s\"\r\n\r\n",
				szBegin, (LPCSTR) m_ContentType, m_szCharset, (LPCSTR) szDisplayName, m_pszEncodeString, (LPCSTR) szFileNameA); 
			return TRUE;
		}
		_ATLCATCHALL()
		{
			return FALSE;
		}
	}
	
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.