Click here to Skip to main content
15,911,848 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have used:
CSMTPMessage* pMessage = CreateMessage("test_host@hotmail", "test_client@hotmail" ,"c:\\Docs\\Letter.txt");

The Email & attachment sending sucessfully, however the attachment show in the client was always untitle1 ... not Letter.txt!

Anyone can help how to define the attachment title? :doh:

Just in case, I attach the function CreateMessage:

CSMTPMessage* CConfirmation::CreateMessage(CSMTPAddress FromAddr, CString ToAddr, CString Attachment)
{
    CSMTPMessage* pMessage          = new CSMTPMessage;

    pMessage->AddMultipleRecipients(ToAddr , CSMTPMessage::TO);
    pMessage->m_sSubject = "Email Confirmation";

    //Attach file here
    pMessage->AddMultipleAttachments(Attachment);

    pMessage->m_From = FromAddr;
    pMessage->m_ReplyTo = FromAddr;

    //New code
    pMessage->AddTextBody(EmailBody);

    #ifdef _DEBUG
      pMessage->AddCustomHeader(_T("X-Program:    CSTMPMessageTester"));
    #endif

    return pMessage;
}
Posted

1 solution

It's unclear where the CSMTPMessage class you are using has come from. If it is from this article[^], then the SetTitle[^] method of the attachment class may help you out. I have no idea why you are seeing Untitled though. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900