Har gjort et program som läser in tävlings-resultat från en access databas. Har skapat en htm-fil med det senaste resultatet som jag sedan mejlar till en tidning. Vill nu låta programmet skicka detta automatiskt. Finns det någon vänlig själ som vill hjälpa mej ? Hej Om det är detta ex som ni tänker på så kan ni skicka med en fil.Mejla från Vb
kikade på ett ett par exempel i 'tips och tricks' ex detta ;
n = Shell("start.exe mailto:wavestorm@tjohoo.se?subject=Titeln", vbHide)
men hur lägger jag dit den text(eller fil) som mejlet ska innehålla ? Sv: Mejla från Vb
Private Sub Command1_Click()
On Error Resume Next
'MAPI constants from CONSTANT.TXT file:
Const SESSION_SIGNON = 1
Const MESSAGE_COMPOSE = 6
Const ATTACHTYPE_DATA = 0
Const RECIPTYPE_TO = 1
Const RECIPTYPE_CC = 2
Const MESSAGE_RESOLVENAME = 13
Const MESSAGE_SEND = 3
Const SESSION_SIGNOFF = 2
'Open up a MAPI session:
MAPISession1.Action = SESSION_SIGNON
'Point the MAPI messages control to the open MAPI session:
MAPIMessages1.SessionID = frmEmail.MAPISession1.SessionID
MAPIMessages1.Action = MESSAGE_COMPOSE 'Start a new message
'Set the subject of the message:
MAPIMessages1.MsgSubject = "Epost meddelande"
'Set the message content:
MAPIMessages1.MsgNoteText = " Skriv vad du vill"
'The following four lines of code add an attachment to the message,
'and set the character position within the MsgNoteText where the
'attachment icon will appear. A value of 0 means the attachment will
'replace the first character in the MsgNoteText. You must have at
'least one character in the MsgNoteText to be able to attach a file.
'MAPIMessages1.AttachmentPosition = 0
'Set the type of attachment:
'MAPIMessages1.AttachmentType = ATTACHTYPE_DATA
'Set the icon title of attachment:
'MAPIMessages1.AttachmentName = "Textdocument"
'Set the path and file name of the attachment:
'Här anger ni vilken fil som ni vill skicka med och sökväg
MAPIMessages1.AttachmentPathName = "c:\Information.txt"
'"C:\din fil.txt"
'Set the recipients
MAPIMessages1.RecipIndex = 0 'First recipient
MAPIMessages1.RecipType = RECIPTYPE_TO 'Recipient in TO line
MAPIMessages1.RecipDisplayName = "epost adress" 'e-mail name
'MESSAGE_RESOLVENAME checks to ensure the recipient is valid and puts
'the recipient address in MapiMessages1.RecipAddress
'If the E-Mail name is not valid, a trappable error will occur.
MAPIMessages1.Action = MESSAGE_RESOLVENAME
'Send the message:
MAPIMessages1.Action = MESSAGE_SEND
'Close MAPI mail session:
MAPISession1.Action = SESSION_SIGNOFF
End Sub
Obs! Ni måste lägga till Mapi i ditt project
Tobbe