IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Discussion :

Créer un mail dans une application


Sujet :

Windows

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 8
    Par défaut Créer un mail dans une application
    Bonjour ,

    Je souhaite créer un mail via mon appli C++ sous pocket PC 2003.
    mon appli s'appelle : PROJET

    Actuellement j'arrive à créer le mail avec tous les paramêtres, mais il se place dans le dossier "BROUILLON" du compte "Courrier Outlook"
    alors que je voudrais qu'il se place dans le répertoire "Boîte d'envoi" du dossier "PROJET" que j'ai paramêtré précédement.

    voici mon code source :

    /////////////////////////////////////////////////////////////////////////////
    // Function name : CMailObj::SubmitMail
    // Description : Creates a new message in the message store
    //
    // Return type : BOOL - RETURNS TRUE if Successful, FALSE otherwise.
    //
    // Argument : LPTSTR lpszTo - Pointer to a string containing
    // Recipient's Name.
    //
    // Argument : LPTSTR lpszSubject - Pointer to a string containing
    // the Message Subject.
    //
    // Argument : LPTSTR lpszBody - Pointer to a string containing
    // the Body of the Message.
    //
    // Argument : LPTSTR lpszAttach - Pointer to a string containing
    // the path & file of the attachment.
    //
    BOOL CEMailHandler::SubmitMail(LPTSTR lpszTo, LPTSTR lpszSubject, LPTSTR lpszBody, LPTSTR lpszAttachPath)
    {
    BOOL bReturn = TRUE;
    HANDLE phNewMail = NULL;
    MailMsg Msg;
    MailAtt MAtt;

    // Check for an attachment
    if (*lpszAttachPath)
    {
    // Clear the MailAtt Structure
    memset(&MAtt, 0, sizeof(MailAtt));

    // Setup the Mail Attachment Structure
    MAtt.uiAttachmentNumber = 1;
    MAtt.dwFlags = NULL;
    //MAtt.ulCharacterPosition; // NOT SUPPORTED YET!
    MAtt.ulSize = NULL; // Not needed since we are sending a local file

    // MAtt.szOriginalName = TEXT("Pièce jointe");
    MAtt.szOriginalName = lpszAttachPath;

    MAtt.szLocalName = lpszAttachPath;

    }
    // Open the message store and obtain a handle to the mail context
    bReturn = MailOpen ( &phNewMail, TRUE );

    // Check for Success
    if ( ( bReturn ) && ( NULL != phNewMail ) )
    {
    bReturn = FALSE;

    // Clear the MailMsg
    memset ( &Msg, 0, sizeof ( MailMsg ) );


    // Specify which transport service we want to send the message.
    Msg.szSvcNam = TEXT("Projet");

    // Specify that we want the msg placed in the Outbox to be sent.
    Msg.dwFlags = MAIL_FOLDER_OUTBOX | MAIL_STATUS_COMPOSED;

    // Set the pointer to the Body of the message.
    Msg.szBody = lpszBody;

    // Set our Header up.
    bReturn = MailSetField ( &Msg, TEXT( "To" ), lpszTo );
    bReturn = MailSetField ( &Msg, TEXT( "Subject" ), lpszSubject );

    // Set Date
    SYSTEMTIME tTime;
    FILETIME ftTime;
    GetSystemTime(&tTime);

    SystemTimeToFileTime(&tTime, &ftTime);
    Msg.ftDate = ftTime;

    // Place the message on the message store.
    bReturn = MailPut ( phNewMail, &Msg );
    if (( bReturn ) && ( NULL != &Msg ))
    {
    if(*lpszAttachPath)
    {
    #ifdef _DEBUG
    char outstring[300];
    wsprintf((unsigned short*)outstring, L"Attachment Path = \"%s\" \n", MAtt.szLocalName);
    OutputDebugString((unsigned short *)outstring);
    #endif
    // Note that MailPutAttachment will attach the file to
    // the mailmsg and also DELETE THE ORIGINAL FILE.
    // You might want to copy the original file
    // before attaching it. Also note that since it deletes
    // the original, you will get an error when attempting
    // to attach a file that exists on ROM.
    bReturn = MailPutAttachment(phNewMail, &Msg, &MAtt);
    }
    }
    }

    // Release our new Mail Handle
    if(phNewMail) MailClose(phNewMail);

    return bReturn;

    }
    Le code "Msg.szSvcNam = TEXT("Projet");" devrait indiquer le nom du dossier dans lequel copier le mail mais apparement cela ne marche pas.
    il se place toujours dans le dossier "Courrier Outlook" par défaut.

    Merci à tout ceux qui tenterons de m'aider.
      0  0

  2. #2
    Expert confirmé

    Homme Profil pro
    pdg
    Inscrit en
    Juin 2003
    Messages
    5 756
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : pdg

    Informations forums :
    Inscription : Juin 2003
    Messages : 5 756
    Billets dans le blog
    3
      0  0

Discussions similaires

  1. Envois d'un e-mail dans une application web JEE 6
    Par sarsar88 dans le forum JSF
    Réponses: 0
    Dernier message: 25/08/2011, 15h29
  2. Problème d'envoi de mail dans une application web
    Par BNacer dans le forum API standards et tierces
    Réponses: 7
    Dernier message: 11/12/2009, 22h22
  3. Réponses: 23
    Dernier message: 28/09/2007, 13h16
  4. Réponses: 40
    Dernier message: 21/06/2007, 17h58
  5. Créer un help dans une application java
    Par baya1 dans le forum API standards et tierces
    Réponses: 6
    Dernier message: 01/04/2007, 23h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo