Address in CMapi doesn't send

I am using CMapi to send a bulk email using MFC.  In my To string, I use a semi-colon to separate addresses and this has been working fine.  However, I have recently added two new email addresses in my list, which for some reason prevent ANY of the recipients from receiving the email if they were included in the same string.

I have done some investigation into the possible reasons for this, and have so far deduced the following.  If I send the same bulk email manually using Outlook, there is no problem.  Also, when I run the same program from another site there is no issue (which leads me to believe it may be something to do with the outgoing mail server).  I can send emails to other addresses with the same domain name, so the domain is not a problem.  Neither are there any characters used in either of these emails which are in others that do work.

I do know that both of these problem-email addresses have mail forwarded to them from other (older) addresses if that helps.  When I use their old addresses, it doesn’t work either.

Any suggestions would be greatly appreciated.
LVL 1
reidy_boyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pgnatyukCommented:
You know that the simplest way to send an email is ShellExecute:
ShellExecute(NULL, L"open",
            L"mailto:someone@somewhere.com\
             ?Subject=Hello, world\
             &body=The email sent from ShellExecute",
            L"", L"", SW_SHOWNORMAL );

Win32 MAPI allows to send emails and it's all explained here:
Sending Email with MAPI
http://www.experts-exchange.com/articles/Programming/System/Windows__Programming/Sending-Email-with-MAPI.html
I prefer this way with Win32.

CMapi is a wrapper for this Simple MAPI.

So all recipients should be added into array. CStringArray?

Here is an example with CMapi (if you need):
http://www.codeguru.com/cpp/i-n/internet/email/article.php/c3371

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
reidy_boyAuthor Commented:
Hi pgnatyuk, this doesn't solve the problem.  When I run this code it creates and opens the email but doesn't send it.  It needs to be automated.

I studied your article which contains a method similar to what I am doing, but the same thing happens.  It would be very useful if I could send emails silently (i.e. without Outlook being open) but when I try this code it leaves the email in the Outbox until I open Outlook?
0
pgnatyukCommented:
I use MAPI, not CMapi. And this article contains the real code that sends email.
There is even a comment how to send an to few recipients.
I'm talking about this article: www.experts-exchange.com/A_1820.html
Take an example from this article and test. Then, as a next step, we'll add one more element to
MapiRecipDesc recipient[1] = { 0 };
recipient[0].ulRecipClass = MAPI_TO;
recipient[0].lpszAddress = szTo;
recipient[0].lpszName = szName;

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

reidy_boyAuthor Commented:
I am using the last example in this article, with NULL as the forth parameter to pMAPISendMail in order to run it in silent mode.  I run this code with Outlook closed and nothing happens.  When I open Outlook the email is there in my Outbox.
0
pgnatyukCommented:
Outlook should be running. Or you need to login before the sending - MAPILogon. How I remember, the last example does it. So modify this part for two or more recipients:
MapiRecipDesc recipient[1] = { 0 };
recipient[0].ulRecipClass = MAPI_TO;
recipient[0].lpszAddress = szTo;
recipient[0].lpszName = szName;

0
pgnatyukCommented:
There is a newer function MAPILogonEx that supports profiles:
http://msdn.microsoft.com/en-us/library/cc815545.aspx
0
reidy_boyAuthor Commented:
I think I have got to the cause of this now.  We are fortunate to be a big enough organisation so I can cross check.  The client doesn't need to be running as long as it's Exchange Server 2007, but not 2003.  As for your code, this also works fine and the recipients who weren't getting emails before are receiving them now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.