Merci pour ta réponse!
J'avais déja fais ça mais ça ne fonctionne pas,j'ai toujours le meme erreur....
Je suis une débutante en dotnet,
le fonctionnement de mon application,c'est que j'ai un formulaire aspx et j'envois via outlook des mails..
Si tu veux je t'envois le code complet, peut etre c'est mon code qui ne fonctionne pas..
----------------------------------------------
WebForm.aspx.vbImports
SystemImports
System.DrawingImports
System.CollectionsImports
System.ComponentModelImports
System.webImports
System.DataPublicClass WebForm15Inherits 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.TextBoxProtectedWithEvents txtSubject As System.Web.UI.WebControls.TextBoxProtectedWithEvents txtBody As System.Web.UI.WebControls.TextBoxProtectedWithEvents btnSend As System.Web.UI.WebControls.ButtonProtectedWithEvents 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.ObjectPrivateSub 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.ClickIf txtTo.Text.Length > 0 And txtSubject.Text.Length > 0 And txtBody.Text.Length > 0 ThenDim oMail AsNew crystalreport.OutlookMailConsole.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.ApplicationDim ns As Outlook.NameSpaceDim fdMail As Outlook.MAPIFolderns = ol.GetNamespace("MAPI")
ns.Logon(, , True, True)Dim newMail As Outlook.MailItemfdMail = 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()EndFunctionEnd
Class
--------------------------------------------------------------------------------------------------------------------------------------
Merci pour la rapidite de ta reponse!!!