oui...ça ne marche toujours pas,ça serait pas au nivo du code?
WebForm.aspx.vb
Imports
System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.web
Imports System.Data PublicClass WebForm15
Inherits System.Web.UI.Page
#
Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.<System.Diagnostics.DebuggerStepThrough()>
PrivateSub InitializeComponent()
EndSubProtectedWithEvents txtTo As System.Web.UI.WebControls.TextBox
ProtectedWithEvents txtSubject As System.Web.UI.WebControls.TextBox
ProtectedWithEvents txtBody As System.Web.UI.WebControls.TextBox
ProtectedWithEvents btnSend As System.Web.UI.WebControls.Button
ProtectedWithEvents btnClear As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.'Do not delete or move it.Private designerPlaceholderDeclaration As System.Object
PrivateSub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Init
'CODEGEN: This method call is required by the Web Form Designer'Do not modify it using the code editor.InitializeComponent()
EndSub#
EndRegionPrivateSub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
'Put user code to initialize the page hereEndSubPrivateSub btnSend_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles btnSend.Click
If txtTo.Text.Length > 0 And txtSubject.Text.Length > 0 And txtBody.Text.Length > 0 ThenDim oMail AsNew crystalreport.OutlookMail
Console.WriteLine("crystalreport.OutlookMail initialisé")
oMail.startOutlook(txtTo.Text, txtSubject.Text, txtBody.Text)
Console.WriteLine("Email est ajouté à outbox")
EndIfEndSub'btnSend_ClickEnd
Class
-------------------------------------------------------------------------------------------------------------------------------------------------
OutlookMail.vb
Imports
System
Imports
OutlookPublic
Class OutlookMail'Public Function startOutlook(ByVal toVal As String, ByVal subjectVal As String, ByVal bodyVal As String)'Param - toVal as String: email address of recipient'Param - subjectVal as String: subject string'Param - bodyVal as String: Email TextPublicFunction startOutlook(ByVal toVal AsString, ByVal subjectVal AsString, ByVal bodyVal AsString)
Dim ol AsNew Outlook.Application
Dim ns As Outlook.NameSpace
Dim fdMail As Outlook.MAPIFolder
ns = ol.GetNamespace("MAPI")
ns.Logon(, , True, True)Dim newMail As Outlook.MailItem
fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)
newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
newMail.Subject = subjectVal
newMail.Body = bodyVal
newMail.To = toVal
newMail.SaveSentMessageFolder = fdMail
newMail.Send() EndFunction End
Class
-------------------------------------------------------------------------------------------------------------------------
Merci de m'avoir répondu!