how to assign multiple Mail ids to CC - using MAPI Handler

kishi_gkishi_g Member Posts: 162
Hi,
Iam sending mails by using MAPI Handler. my problem is i assigned multipled mail id's to MAPIHandler."CC Name" then mail will not be generated. if i assigned single mail id to MAPIHandler."CC Name" then only mail will be generated.
how can i assign multiple mail id's to MAPIHandler."CC Name" .


Thanks & Regards,
Kishore....

Comments

  • jflkjflk Member Posts: 2
    The problem with the code examples I found were that they only showed how to send an e-mail to 1 person or CC 1 person. Problem was when you wanted more than 1 person on the list.

    I was using Mapi.

    All the examples I found were resolving the names after the To string or CC string had been created. This gave the error that Mapi could not resolve the To or CC.

    This worked for me!!!!!!!

    IF CCName <> '' THEN BEGIN
    // Multiple Receipients
    WHILE STRPOS(CCName, ';') > 0 DO BEGIN
    MAPIMessages.RecipIndex := MAPIMessages.RecipCount;
    MAPIMessages.RecipType := 2;
    MAPIMessages.RecipDisplayName := COPYSTR(CCName,1, STRPOS(CCName, ';')-1); //INSERTED CODE TO STRIP SINGLE NAME FROM STRING
    MAPIMessages.AddressResolveUI(HideDialog);
    MAPIMessages.ResolveName; //INSERTED CODE TO RESOLVE RECIPIENT
    CCName := DELSTR(CCName,1, STRPOS(CCName, ';'));
    END;

    MAPIMessages.RecipIndex := MAPIMessages.RecipCount;
    MAPIMessages.RecipType := 2;
    MAPIMessages.RecipDisplayName := CCName;
    END;


    MAPIMessages.MsgSubject := Subject;

    IF AttachFileName = '' THEN
    MAPIMessages.MsgNoteText := Body + Body2 + Body3 + Body4 + Body5
    ELSE BEGIN
    MAPIMessages.MsgNoteText := Body + ' ';
    MAPIMessages.AttachmentIndex := MAPIMessages.AttachmentCount;
    MAPIMessages.AttachmentType := 0;
    MAPIMessages.AttachmentPathName := AttachFileName;
    MAPIMessages.AttachmentPosition(STRLEN(Body));
    END;

    //REMOVED CODE WHICH WAS ONLY RESOLVING THE NAME AT THE END OF THE ROUTINE
    //IF (ToName <> '') OR (CCName <> '') THEN BEGIN
    // MAPIMessages.AddressResolveUI(TRUE);

    //MAPIMessages.AddressResolveUI(HideDialog);
    //MAPIMessages.ResolveName;
    //END;
Sign In or Register to comment.