Click here to Skip to main content
15,890,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Save web page Pin
«_Superman_»20-Sep-10 0:12
professional«_Superman_»20-Sep-10 0:12 
GeneralRe: Save web page [modified] Pin
CPallini20-Sep-10 0:40
mveCPallini20-Sep-10 0:40 
GeneralRe: Save web page Pin
mesajflaviu22-Sep-10 22:55
mesajflaviu22-Sep-10 22:55 
GeneralRe: Save web page Pin
CPallini22-Sep-10 23:00
mveCPallini22-Sep-10 23:00 
QuestionCombining all files in single file Pin
learningvisualc19-Sep-10 22:31
learningvisualc19-Sep-10 22:31 
AnswerRe: Combining all files in single file Pin
«_Superman_»19-Sep-10 22:54
professional«_Superman_»19-Sep-10 22:54 
AnswerRe: Combining all files in single file PinPopular
Aescleal20-Sep-10 0:33
Aescleal20-Sep-10 0:33 
QuestionSending email with attachment problem Pin
AnayKulkarni19-Sep-10 19:33
AnayKulkarni19-Sep-10 19:33 
Hello to all,
In my project I am sending email with attachment of jpeg image. I am using following user defined function in which logic of sending mail is written,

In foolowing function
lpszSubject = subject of mail
lpszTo = email address to whom u want to send mail
lpszName = name of person to whom u want to send mail
lpszText = email text
lpszFullFileName = path of the jpeg file to be attached


BOOL SendFile(LPCSTR lpszSubject, LPCSTR lpszTo,
LPCSTR lpszName, LPCSTR lpszText,
LPCSTR lpszFullFileName)
{
HINSTANCE hMAPI = ::LoadLibrary("mapi32.dll");
LPMAPISENDMAIL lpfnMAPISendMail =
(LPMAPISENDMAIL)::GetProcAddress(hMAPI, "MAPISendMail");

char szDrive[_MAX_DRIVE] = { 0 };
char szDir[_MAX_DIR] = { 0 };
char szName[_MAX_FNAME] = { 0 };
char szExt[_MAX_EXT] = { 0 };


char szFileName[MAX_PATH] = { 0 };
strcat(szFileName, szName);
strcat(szFileName, szExt);

char szFullFileName[MAX_PATH] = { 0 };
strcat(szFullFileName, lpszFullFileName);

MapiFileDesc MAPIfile = { 0 };
ZeroMemory(&MAPIfile, sizeof(MapiFileDesc));
MAPIfile.nPosition = -1;
MAPIfile.lpszPathName = szFullFileName;
MAPIfile.lpszFileName = szFileName;

char szTo[MAX_PATH] = { 0 };
strcat(szTo, lpszTo);

char szNameTo[MAX_PATH] = { 0 };
strcat(szNameTo, lpszName);

MapiRecipDesc recipient = { 0 };
recipient.ulRecipClass = MAPI_TO;
recipient.lpszAddress = szTo;
recipient.lpszName = szNameTo;

char szSubject[MAX_PATH] = { 0 };
strcat(szSubject, lpszSubject);

char szText[MAX_PATH] = { 0 };
strcat(szText, lpszText);

MapiMessage MAPImsg = { 0 };
MAPImsg.lpszSubject = szSubject;
MAPImsg.lpRecips = &recipient;
MAPImsg.nRecipCount = 1;
MAPImsg.lpszNoteText = szText;
MAPImsg.nFileCount = 1;
MAPImsg.lpFiles = &MAPIfile;

ULONG nSent = lpfnMAPISendMail(0, 0, &MAPImsg, NULL, 0);

FreeLibrary(hMAPI);
return (nSent == SUCCESS_SUCCESS || nSent == MAPI_E_USER_ABORT);

}

Now everything is working fine but I am getting some surprising results as below
(1)If at the sending side user is using Outlook Express then email goes with attachment perfectly at the receiving side on any mail client
(2)But if at the sending side user is using Microsoft Office Outlook then email goes but attachment is missing at receiving side. If at the receiving side also Microsoft Office Outlook is there then only we get the attachment.

Means in short from Microsoft Office Outlook to Microsoft Office Outlook email goes with attachment at receiving side.
but from Microsoft Office Outlook to other mail client (other than Microsoft Office Outlook) attachment is missing at receiving side.

Please anyone can tell me what I am missing in my code and how to solve this problem. It is really very very urgent so please help me out.

Thanks and Regards,
Anay

QuestionRe: Sending email with attachment problem Pin
David Crow20-Sep-10 5:37
David Crow20-Sep-10 5:37 
QuestionHow to make the Memory Pool thread safe ? [modified][solved] Pin
yu-jian19-Sep-10 17:50
yu-jian19-Sep-10 17:50 
AnswerRe: How to make the Memory Pool thread safe ? [modified] Pin
Aescleal20-Sep-10 0:07
Aescleal20-Sep-10 0:07 
GeneralRe: How to make the Memory Pool thread safe ? Pin
Maximilien20-Sep-10 1:28
Maximilien20-Sep-10 1:28 
GeneralRe: How to make the Memory Pool thread safe ? Pin
Aescleal20-Sep-10 6:02
Aescleal20-Sep-10 6:02 
AnswerRe: How to make the Memory Pool thread safe ? [modified][solved] Pin
basementman23-Sep-10 4:37
basementman23-Sep-10 4:37 
AnswerRe: How to make the Memory Pool thread safe ? [modified][solved] Pin
Blake Miller28-Sep-10 11:24
Blake Miller28-Sep-10 11:24 
QuestionWhat is the different between Synchronization and block? Pin
yu-jian19-Sep-10 17:45
yu-jian19-Sep-10 17:45 
AnswerRe: What is the different between Synchronization and block? Pin
Moak20-Sep-10 0:36
Moak20-Sep-10 0:36 
GeneralRe: What is the different between Synchronization and block? Pin
yu-jian22-Sep-10 5:07
yu-jian22-Sep-10 5:07 
QuestionHow to change color in vs2008 feature pack? Pin
hanlei000000000919-Sep-10 15:40
hanlei000000000919-Sep-10 15:40 
QuestionAutoComplete with CListCtrl ? Pin
mesajflaviu19-Sep-10 8:22
mesajflaviu19-Sep-10 8:22 
AnswerRe: AutoComplete with CListCtrl ? Pin
«_Superman_»19-Sep-10 20:52
professional«_Superman_»19-Sep-10 20:52 
GeneralRe: AutoComplete with CListCtrl ? Pin
mesajflaviu20-Sep-10 7:13
mesajflaviu20-Sep-10 7:13 
QuestionGetting window name in different language. Pin
gateway2319-Sep-10 2:20
gateway2319-Sep-10 2:20 
AnswerRe: Getting window name in different language. Pin
AmbiguousName19-Sep-10 4:13
AmbiguousName19-Sep-10 4:13 
AnswerRe: Getting window name in different language. Pin
Luc Pattyn19-Sep-10 5:07
sitebuilderLuc Pattyn19-Sep-10 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.