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

VBA Access Discussion :

envoi de mail sous lotus


Sujet :

VBA Access

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Inscrit en
    Mai 2008
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 3
    Par défaut envoi de mail sous lotus
    Bonjour à tous

    J'ai petit soucis sur une ligne de commande.

    J'ai un petit program qui me permettais d'envoyer des mails via Lotus notes 6.5 et depuis une mise à jours de Version Lotus Notes 7.0 mon, je ne peux plus envoyer de mail.

    Pouvez-vous m'aider à éclaircir ce problème ?

    Merci

    Voila les quelques lignes :

    Function SendNotesMail(Optional Subject As String, Optional Attachment As String, Optional RECIPIENT As String, Optional BodyText As String, Optional SaveIt As Boolean, Optional Version_Notes As Boolean) As Boolean
    'Public Sub SendNotesMail(Subject as string, attachment as string,
    'recipient as string, bodytext as string,saveit as Boolean)
    'This public sub will send a mail and attachment if neccessary to the
    'recipient including the body text.
    'Requires that notes client is installed on the system.
    'Set up the objects required for Automation into lotus notes
    Dim Maildb As Object 'The mail database
    Dim UserName As String 'The current users notes name
    Dim MailDbName As String 'THe current users notes mail database name
    Dim MailDoc As Object 'The mail document itself
    Dim AttachME As Object 'The attachment richtextfile object
    Dim Session As Object 'The notes session
    Dim EmbedObj As Object 'The embedded object (Attachment)
    'Start a session to notes
    Set Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    'You may or may not need this as for MailDBname with some systems you
    'can pass an empty string
    UserName = Session.UserName

    '* Ligne supprimée pour LOTUS NOTES 7
    'MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

    'Open the mail database in notes
    Set Maildb = Session.GETDATABASE("", MailDbName)
    If Maildb.IsOpen = True Then
    'Already open for mail
    Else
    Maildb.OPENMAIL
    End If
    'Set up the new mail document
    Set MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    MailDoc.SENDTO = RECIPIENT
    MailDoc.Subject = Subject
    MailDoc.Body = BodyText
    MailDoc.SAVEMESSAGEONSEND = SaveIt
    'Set up the embedded object and attachment and attach it
    If Attachment <> "" Then
    Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
    Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")

    ' Partie de code enlevée sinon plantage pour notes 6.5
    ' If Version_Notes = True Then ' Si la version de notes est = ou superieure a 5
    ' MailDoc.CREATERICHTEXTITEM ("Attachment")
    ' End If
    End If
    'Send the document
    MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
    MailDoc.Send 0, RECIPIENT
    'Clean Up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing

    SendNotesMail = True
    End Function

  2. #2
    Membre confirmé Avatar de Orakle
    Homme Profil pro
    Responsable Informatique
    Inscrit en
    Mars 2004
    Messages
    204
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 56
    Localisation : France, Aube (Champagne Ardenne)

    Informations professionnelles :
    Activité : Responsable Informatique
    Secteur : Transports

    Informations forums :
    Inscription : Mars 2004
    Messages : 204
    Par défaut
    Salut,

    c'est toujours mieux d'écrire ton code entre balises adéquates

    Ceci dit, essayes ce script qui chez moi marche depuis la 6.5

    il est sensiblement le même à part quelques lignes que tu as mis en commentaire et qui chez moi restent en dur.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    Public Sub SendNotes(ByVal Subject As String, ByVal Attachment As String, _
                             ByVal Recipient As String, ByVal ccRecipient As String, _
                             ByVal bccRecipient As String, ByVal BodyText As String, _
                             ByVal SaveIt As Boolean, ByVal Password As String)
     
        Dim Maildb As Object      'La base des mails
        Dim UserName As String    'Le nom d'utilisateur
        Dim MailDbName As String  'Le nom de la base des mails
        Dim MailDoc As Object     'Le mail
        Dim AttachME As Object    'L'objet pièce jointe en RTF
        Dim Session As Object     'La session Notes
        Dim EmbedObj As Object    'L'objet incorporé
     
        'Crée une session notes
        Set Session = CreateObject("Notes.NotesSession")
     
        '*** Cette ligne est réservée aux versions 5.x et supérieur : ***
       ' Session.Initialize (Password)
     
        'Récupère le nom d'utilisateur et crée le nom de la base des mails
        UserName = Session.UserName
        MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
     
        'Ouvre la base des mails
        Set Maildb = Session.GETDATABASE("", MailDbName)
        If Not Maildb.ISOPEN Then Maildb.OPENMAIL
     
     
        'Paramètre le mail à envoyer
        Set MailDoc = Maildb.CREATEDOCUMENT
        MailDoc.Form = "Memo"
        MailDoc.sendto = Recipient
        MailDoc.CopyTo = ccRecipient
        MailDoc.BlindCopyTo = bccRecipient
        MailDoc.Subject = Subject
        MailDoc.Body = BodyText
        MailDoc.SAVEMESSAGEONSEND = SaveIt
     
        'Prend en compte les pièces jointes
        If Attachment <> "" Then
            Set AttachME = MailDoc.CreateRichTextItem("Piece jointe")
            Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Piece jointe")
           ' MailDoc.CreateRichTextItem ("Piece jointe")
        End If
     
     
        'Envoie le mail
        MailDoc.PostedDate = Now()
        MailDoc.SEND 0, Recipient
     
        Set Maildb = Nothing
        Set MailDoc = Nothing
        Set AttachME = Nothing
        Set Session = Nothing
        Set EmbedObj = Nothing
    End Sub
    Si ça ne fonctionne pas c'est que ton problème vient d'ailleurs ...
    Peut être de l'appel de ta fonction

  3. #3
    Candidat au Club
    Inscrit en
    Mai 2008
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 3
    Par défaut Pb d'envoi de mail
    Salut Orakle

    Merci pour ta reponse et des ligne de commande que tu ma donné mais cela ne fonctionne pas, j'ai a peux pret la meme fonctione mais ca ne fonctionne pas avec la version 7 de lotus notes.

    Est ce que tu aurais une autre idée ?

    Merci

  4. #4
    Candidat au Club
    Inscrit en
    Mai 2008
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 3
    Par défaut Pb d'envoi de mail
    Salut

    Par rapport aux lignes de commande et avec une modification que j'ai apportée dessus, je peux maintenant envoyer des mails.

    Mais maintenant j'ai un autre problème car maintenant il n'affiche pas le mail envoyé dans la rubrique " Mail Envoyé "

    Voila les lignes avec la modification :

    Merci pour ta réponse


    Function SendNotesMail(Optional Subject As String, Optional Attachment As String, Optional RECIPIENT As String, Optional BodyText As String, Optional SaveIt As Boolean, Optional Version_Notes As Boolean) As Boolean
    'Public Sub SendNotesMail(Subject as string, attachment as string,
    'recipient as string, bodytext as string,saveit as Boolean)
    'This public sub will send a mail and attachment if neccessary to the
    'recipient including the body text.
    'Requires that notes client is installed on the system.
    'Set up the objects required for Automation into lotus notes
    Dim Maildb As Object 'The mail database
    Dim UserName As String 'The current users notes name
    Dim MailDbName As String 'THe current users notes mail database name
    Dim MailDoc As Object 'The mail document itself
    Dim AttachME As Object 'The attachment richtextfile object
    Dim Session As Object 'The notes session
    Dim EmbedObj As Object 'The embedded object (Attachment)
    'Start a session to notes
    Set Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    'You may or may not need this as for MailDBname with some systems you
    'can pass an empty string
    UserName = Session.UserName

    '* Ligne supprimée pour LOTUS NOTES 7
    'MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"

    'Open the mail database in notes
    Set Maildb = Session.GETDATABASE("", MailDbName)
    If Maildb.IsOpen = True Then
    'Already open for mail
    Else
    Maildb.OPENMAIL
    End If
    'Set up the new mail document
    Set MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    MailDoc.SENDTO = RECIPIENT
    MailDoc.Subject = Subject
    MailDoc.Body = BodyText
    MailDoc.SAVEMESSAGEONSEND = SaveIt
    'Set up the embedded object and attachment and attach it
    If Attachment <> "" Then
    Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
    Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")

    ' Partie de code enlevée sinon plantage pour notes 6.5
    ' If Version_Notes = True Then ' Si la version de notes est = ou superieure a 5
    ' MailDoc.CREATERICHTEXTITEM ("Attachment")
    ' End If
    End If
    'Send the document
    MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
    MailDoc.Send 0, RECIPIENT
    'Clean Up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing

    SendNotesMail = True
    End Function

  5. #5
    Membre confirmé Avatar de Orakle
    Homme Profil pro
    Responsable Informatique
    Inscrit en
    Mars 2004
    Messages
    204
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 56
    Localisation : France, Aube (Champagne Ardenne)

    Informations professionnelles :
    Activité : Responsable Informatique
    Secteur : Transports

    Informations forums :
    Inscription : Mars 2004
    Messages : 204
    Par défaut
    Bonjour,

    non effectivement c'est un aspect négatif de ce script qui ne montre pas le mail dans les éléments "Envoyés".

    Mais personnellement je n'en ai pas besoin donc ne suis jamais allé plus loin dans cette recherche.

    Par contre on peu envoyer n'importe quoi par cette fonction, pour peu qu'on en donne le chemin complet (en local ou en réseau).

Discussions similaires

  1. [AC-2007] Affichage d'un mail sous lotus avant envoie
    Par salent9 dans le forum VBA Access
    Réponses: 1
    Dernier message: 19/05/2014, 15h48
  2. Réponses: 3
    Dernier message: 03/05/2014, 00h15
  3. [XL-2003] Apercu d'un mail sous Lotus avant envoi
    Par toinou28 dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 01/05/2010, 19h43
  4. Envoi de Mail par lotus Notes, sous un autre compte
    Par mascletjp dans le forum VB 6 et antérieur
    Réponses: 1
    Dernier message: 22/10/2007, 16h08
  5. Envoi de mail avec Lotus Notes depuis VB
    Par mdriesbach dans le forum VB 6 et antérieur
    Réponses: 9
    Dernier message: 09/11/2005, 16h29

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