res = Send_eMail(\"jacob@japlex.dk\", \"test\", \"TestTekst\") If res = False Then MsgBox \"Kunne ikke sende mail\" Else MsgBox \"Mail er sendt\" End If
End Sub
Public Function Send_eMail(sendto As String, subject As String, _ text As String) As Boolean
With CommonDialog1 .CancelError = True .DialogTitle = \"Hent vedhæftning\" .Filter = \"Tekstfiler|*.txt|Alle filer|*.*\" \'udvælger hvilke filtyper der skal kune åbnes .FilterIndex = 1 .Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly .InitDir = \"C:\\Programmer\\Cvm\\Ugeplaner\" .ShowOpen
End With
On Error GoTo ErrHandler MAPISession1.SignOn MAPIMessages1.SessionID = MAPISession1.SessionID With MAPIMessages1 .Compose .RecipDisplayName = sendto .AddressResolveUI = True .ResolveName .MsgSubject = subject .MsgNoteText = text .AttachmentName = CommonDialog1.Filename .AttachmentPathName = \"C:\\Programmer\\Cvm\\Ugeplaner\\\" .Send End With Send_eMail = True MAPISession1.SignOff Exit Function ErrHandler: MsgBox Err.Description Send_eMail = False End Function
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.