Visualizzazione dei risultati da 1 a 9 su 9
  1. #1

    [Vb.Net]Inviare e-mail con outlook

    Tramite un porgramma vb.net come faccio a creare un e-mail da inviare con outlook. Ho provato a inserire l'e-mail in una labelLink ma nn lo fa in automatico... devo creare un e-mail che abbia come destinatario l'e-mail che scelgo da codice, e come oggetto ciò che volgio da codice. il testo deve essere scritto in outlook
    Grazie mille
    -----
    101110101011101111100000
    -----

  2. #2
    System.Web.Mail

    è la classe, ma non usi Outlook ma l' SMTP della rete.

    Oppure se vuoi usare il Mailto:

    IL comando è Mailto:raf@raf.com?Subject='Soggetto' ...

  3. #3
    Originariamente inviato da raffaeu
    System.Web.Mail

    è la classe, ma non usi Outlook ma l' SMTP della rete.

    Oppure se vuoi usare il Mailto:

    IL comando è Mailto:raf@raf.com?Subject='Soggetto' ...
    Vorrei usare outlook, nn voglio dover gestire il testo dal mio programma. Poi Uso oulook perchè deve preparare tutte le e-mail ed inviarle in botto... Grazie mille
    -----
    101110101011101111100000
    -----

  4. #4
    se vuoi usare Outlook leggiti qualcosa su google cercando

    'VB.NET and Outllok Interop'

  5. #5
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480

    Re: [Vb.Net]Inviare e-mail con outlook

    Ovviamente non parli di Outlook Express ma di Outlook di Office ... giusto?

  6. #6
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    116
    Ciao!
    Tempo fa ho creato un DB in Access(quindi VBA) per l'invio di email personalizzate ed in rete ho trovato questa funzione che ho poi personalizzato a seconda delle mie esigenze.
    Ho notato che funziona con Outlook 2000 però l'outlook non deve essere assolutamente aggiornato, senza le service release della microsoft altrimenti questo blocca tutti i lanci di email dalle varie applicazioni per evitare virus!
    Spero ti serva,
    andrea



    Function Send_OutlookMsgSINGOLO(Optional ByVal sSendTo As Variant, Optional ByVal sSubject As String, Optional ByVal sBodyText As String, Optional ByVal sAttachment1, Optional ByVal sAttachment2) As Long
    '************************************************* *******************
    'All arguments are optional
    'sSendTo should be passed in as an array of strings(or variant array)
    'for multiple recipients or if only using 1 recipient as a string
    '************************************************* *******************
    Dim i As Integer
    Dim appOutl As Object 'outlook.Application object
    Dim ns As Object 'Outlook.NameSpace object
    Dim maiMail As Object
    Dim ToContact As Object 'Outlook.Recipient


    On Error GoTo err_Send_OutlookMsg
    'The boolean variable is optional,dim only if you will be using it
    'Dim boorecip As Boolean

    Set appOutl = CreateObject("Outlook.Application")
    'use the following 2 lines to automatically log on to
    'Outlook if needed otherwise comment out
    Set ns = appOutl.GetNamespace("MAPI")
    'provide the profilename, if no password leave blank
    ns.Logon "Blake Hartman", , False, True

    Set maiMail = appOutl.CreateItem(0) 'equivalent of Outlook constant olmailitem
    With maiMail
    '.OutputFormat = acFormatHTML
    If Not IsMissing(sSubject) Then .Subject = sSubject
    If Not IsMissing(sBodyText) Then .HTMLBody = sBodyText
    If Not IsMissing(sAttachment1) Then .Attachments.Add sAttachment1
    If Not IsMissing(sAttachment2) Then .Attachments.Add sAttachment2
    If Not IsMissing(sSendTo) Then
    If VarType(sSendTo) = 8200 Or VarType(sSendTo) = 8204 Then
    'there are multiple recipients
    'if it is an array of strings vbString + VbArray or 82000
    'or it is an array of variant type vbVariant + vbArray or 8204
    For i = LBound(sSendTo) To UBound(sSendTo)
    If sSendTo(i) <> "" Then
    Set ToContact = .recipients.Add(sSendTo(i))
    ToContact.Type = 3
    End If
    Next
    Else
    'It should just be one recipient
    .To = sSendTo
    'If VarType(sSendTo) = vbString Then .bcc sSendTo
    End If
    End If
    'Optional test against addressbook is
    ' boorecip = .Recipients.ResolveAll
    'You might want to insert a conditinal here if boorecip=False
    'If Not IsMissing(sSendTo) Or boorecip = True Then
    If Not IsMissing(sSendTo) Then
    ' ToContact.Type = 3
    '.Display
    .Send
    'Use .Send instead of .Display to send the msg without displaying it
    '.Display
    Else
    'message must be displayed because they have not added
    'any recipients
    .Display
    End If

    End With
    Send_OutlookMsgSINGOLO = 0
    exit_Send_OutlookMsg:
    On Error Resume Next
    Set maiMail = Nothing
    Set appOutl = Nothing
    Set ns = Nothing
    Exit Function
    err_Send_OutlookMsg:
    Send_OutlookMsgSINGOLO = Err.Number
    MsgBox "[" & Err.Number & "] " & Err.Description
    Resume exit_Send_OutlookMsg
    End Function

  7. #7

    Re: Re: [Vb.Net]Inviare e-mail con outlook

    Originariamente inviato da oregon
    Ovviamente non parli di Outlook Express ma di Outlook di Office ... giusto?
    mmh, speravo lanciasse il client predefinito di osta (che per esempio nel mio pc è Opera 7.5.4. ma cmq il programa andrà installato su un pc nel quale è presente Office 2000 quindi c'è outlook 2000. però è aggiornato. al sp4. Non posso non aggiornarlo perchè deve mantenere le impostazioni con kerio mailserver. Proverò la strada dei socket. Grazie mille di tutto. se avete altre idee...
    -----
    101110101011101111100000
    -----

  8. #8
    Si ma da NET per usare la tua funzione devi prima creare l' Interop di Outlook ...

  9. #9
    usandolo con linklabel non funziona.... cercherò qualcosa con le interop di office.
    -----
    101110101011101111100000
    -----

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.