Rechercher : dans
Par :

Macro pour envoyer des mails sous Lotus Notes

Dernière réponse le 26 mai 2008 à 15:23:36 wam202, le 18 mar 2008 à 11:52:33 
 Signaler ce message aux modérateurs

Bonjour,
Je cherche à construire une macro capable d'envoyer un mail (je changerai le corps du message à chaque envoi) avec, éventuellement, un fichier excel en PJ.

Quelqu'un pourrait-il m'aider svp ?

merci !

Configuration: Windows 2000
Internet Explorer 6.0

Meilleures réponses pour « macro pour envoyer des mails sous Lotus Notes » dans :
Télécharger Recovery for Lotus Notes VoirPour votre information, Lotus Notes est un programme collaboratif permettant la gestion de projets, de courriels et des échanges d'informations autour d'une base commune. Recovery for Lotus Notes est comme son nom l'indique, un moyen de récupération...

1

madjon6, le 18 mar 2008 à 11:58:09

Bonjour interresé aussi

Merci

Répondre à madjon6

2

wam202, le 18 mar 2008 à 12:00:57

J'ai oublié de (re)préciser que je souhaite que les mails soient envoyés sous Lotus Notes ...

Répondre à wam202

3

dragon75, le 2 avr 2008 à 14:13:47

Salut j'ai développé une macro sous excel pour mes besoins elle fonctionne pour ouvrir des incidents auprès de notre centre d'incident.

Pour utiliser il faut :
- Créer un module dans excel et faire un copier coller du code ci dessous
- Créer un bouton auquel on associe l'appel à la fonction sendnotesmail avec en paramétre les données de la fonction, j'ai pris des nom signifiant pour simplifier.
- Attention : recipient est une table (a vous de voir combien de destinataires maxi vous voulez (moi j'en ai mis deux)
- Responsable est pour moi le demandeur (la personne qui est en copie on peut mettre une table aussi mais il faut mettre variant à la place de string. j'ai préparé les destinataires cachés mais sans les utiliser.
Les commentaires sont en anglais, car pour moi c'est plus facile (question d'habitude) ayant toujours programmé en anglais.

Si ce code vous a été utile merci de me la faire savoir, ça me fera plaisir. ;-)

Bye !

Sub SendNotesMail(subject As String, Attachment As String, recipient As Variant, bodytext As String, SaveIt As Boolean, responsable As String)
'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)
Dim test1 As String
Dim test2 As Integer
Dim Len_Att As Double
Dim Str_Att, St_Len As Double
Dim Nbr_Att As Integer
Dim Att_Pos, St_Str, St_Pos As Integer
Dim X_Attachement$
Dim X_Attach, Str_SendTo As String

'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
'test1 = Sheets("demande").Cells(1, 3)
'test2 = InStr(3, Sheets("demande").Cells(1, 3), " ")
MailDbName = " "
'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
If Attachment <> " " Then
Set AttachME = MailDoc.CREATERICHTEXTITEM(Attachment)
Set EmbedObj = AttachME.embedobject(1454, "", Attachment, "ATT")
MailDoc.CREATERICHTEXTITEM ("ATT")
End If


MailDoc.Form = "Memo"
MailDoc.sendto = recipient
'MailDoc.CopyTo = responsable
'MailDoc.BlindCopyTo = bccRecipient
'sendto(0) = first
'sendto(1) = second
' maildoc.sendto = sendto
If responsable <> " " Then
MailDoc.Copyto = responsable
End If
MailDoc.subject = subject
MailDoc.body = bodytext
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
'read the attachment string and generate a number of attachment equal to the selected attachment
'must be separated by a chr$(10)
'in case of other separator change the instr$ command
'
' Set AttachME = MailDoc.CREATELINKHOTSPOTITEM("file:\\chaumapps\partage$")
' Set EmbedObj = AttachME.embedobject(AttachME)

'
'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
End Sub

Répondre à dragon75

4

wam202, le 2 avr 2008 à 14:29:48

Merci beaucoup, j'ai hâte de la tester !!
en revanche, mon anglais est plutôt moyen... vous serait -il possible de traduire, svp ?

d'avance merci

++

Répondre à wam202

5

wam202, le 2 avr 2008 à 14:32:38

Que signifie "(subject As String, Attachment As String, recipient As Variant, bodytext As String, SaveIt As Boolean, responsable As String)" au début ?
sont-ce les variables à déclarer ?

Répondre à wam202

8

 jaqpotjaq, le 26 mai 2008 à 15:23:36

Pour ma part j'ai mis toutes ces variables en les déclarant une a unes

au lieu de
(subject As String, Attachment As String, recipient As Variant, bodytext As String, SaveIt As Boolean, responsable As String)

j'ai

()
dim subject as string
dim attachment as ..
....


et ensuite

recipient = xxx@xxx.fr

Répondre à jaqpotjaq

6

madjon6, le 2 avr 2008 à 17:05:08

No se

Répondre à madjon6

7

jaqpotjaq, le 26 mai 2008 à 15:08:26

Merci,

ca fonctionne,
encore qq modif pour l'ajuster à mes besoins mais c'est parfait

Répondre à jaqpotjaq