L'action " Envoyer un e-mail " permet-elle de faire un envoi de groupe ( ajouter plusieurs adresses de destinataire ?
[....] d'envoyer plusieurs pièces jointe en même temps ?
Cordialement ,
Le réparateur de PC
Private Function EnvoyerMail() As Boolean
' Définition des variables
Dim objMessage As System.Net.Mail.MailMessage
Dim objSMTPClient As System.Net.Mail.SmtpClient
Try
' définition du message
objMessage = New System.Net.Mail.MailMessage()
' Adresse email de l'expéditeur
objMessage.From = New System.Net.Mail.MailAddress("Email de l'expéditeur")
' Adresse email des destinataires
objMessage.To.Add("Email du destinataire 1")
objMessage.To.Add("Email du destinataire 2")
' message
objMessage.Subject = "Sujet du message"
objMessage.Body = "Corp du message"
objMessage.IsBodyHtml = False
' définition du serveur et envoie
objSMTPClient = New System.Net.Mail.SmtpClient("SMTP de l'expéditeur", 587)
objSMTPClient.EnableSsl = True
objSMTPClient.Credentials = New NetworkCredential("Email de l'expéditeur", " Son mot de passe")
objSMTPClient.Send(objMessage)
MsgBox("Ok")
Catch ex As Exception
MsgBox("Exception : " & ex.Message)
End Try
End Function
Imports System.Net
Imports System.Net
Project : test_mail_autre
Last build the samedi 2 juillet 2011 at 17:46
Building failed : errors number: 12
File code : C:\Program Files\Veler Software\SoftwareZator 2011\Temp\Code.vb
Project setting :
Type : ApplicationWindows
Debug : Classique
FormStart : WindowsForm1.szw
SplashScreen :
Optimize : True
----------------------------------------------------------------
2 - Line 0, Column 0, Error BC2007 : option 'win32manifest:"D:\Mes documents\Mes Projets SoftwareZator\test_mail_autre\Bin\test_mail_autre.manifest"'; non reconnue ignorée
3 - Line 147, Column 0, Error BC30384 : 'Try' doit se terminer par un 'End Try' correspondant.
4 - Line 147, Column 0, Error BC30030 : Try doit utiliser au moins un 'Catch' ou 'Finally'.
5 - Line 148, Column 0, Error BC30035 : Erreur de syntaxe.
6 - Line 149, Column 0, Error BC30289 : Cette instruction ne peut pas apparaître dans le corps d'une méthode. Elle est interprétée comme la fin de la méthode.
7 - Line 172, Column 0, Error BC30002 : Type 'NetworkCredential' non défini.
8 - Line 174, Column 0, Error BC30454 : L'expression n'est pas une méthode.
9 - Line 177, Column 0, Error BC30454 : L'expression n'est pas une méthode.
10 - Line 180, Column 0, Error BC30689 : Cette instruction ne peut pas apparaître en dehors du corps d'une méthode.
11 - Line 181, Column 0, Error BC30188 : Déclaration attendue.
12 - Line 182, Column 0, Error BC30383 : 'End Try' doit être précédé d'un 'Try' correspondant.
13 - Line 183, Column 0, Error BC30429 : 'End Sub' doit être précédé d'un 'Sub' correspondant.
----------------------------------------------------------------
' NOTE :
' TOUTES MODIFICATIONS APPORTEES A CE FICHIER CODE NE SERONT PAS PRISES EN COMPTE LORS DE LA REGENERATION DU PROJET.
'------------------------------------------------------------------------------
' <auto-generated>
' Ce code a été généré par un outil.
' Version du runtime :2.0.50727.5420
'
' Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
' le code est régénéré.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
<Assembly: Reflection.AssemblyTitle("test_mail_autre")>
<Assembly: Reflection.AssemblyDescription("")>
<Assembly: Reflection.AssemblyCompany("")>
<Assembly: Reflection.AssemblyProduct("")>
<Assembly: Reflection.AssemblyCopyright("Copyright © 2011")>
<Assembly: Reflection.AssemblyTrademark("")>
<Assembly: Reflection.AssemblyVersion("1.0.0.0")>
<Assembly: Reflection.AssemblyFileVersion("1.0.0.0")>
<Assembly: Runtime.InteropServices.ComVisible(True)>
'Ce Namespace a été généré par SoftwareZator 2011 Edition Professionnel (2.0.0.1)
Namespace test_mail_autre
Public Class WindowsForm1_f
Inherits System.Windows.Forms.Form
Public WithEvents button1 As System.Windows.Forms.Button
Public WithEvents components As System.ComponentModel.IContainer
Public Sub New()
MyBase.New
Me.InitializeComponent
End Sub
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(WindowsForm1_f))
Me.button1 = New System.Windows.Forms.Button
Me.SuspendLayout
'
'button1
'
Me.button1.Location = New System.Drawing.Point(193, 305)
Me.button1.Name = "button1"
Me.button1.Size = New System.Drawing.Size(75, 23)
Me.button1.TabIndex = 1
Me.button1.Text = "button1"
Me.button1.UseVisualStyleBackColor = true
'
'WindowsForm1
'
Me.ClientSize = New System.Drawing.Size(535, 397)
Me.Controls.Add(Me.button1)
Me.Icon = CType(resources.GetObject("$this.Icon"),System.Drawing.Icon)
Me.Name = "WindowsForm1"
Me.Text = "WindowsForm1"
Me.ResumeLayout(false)
End Sub
<System.STAThreadAttribute()> _
Public Shared Sub Main()
System.Windows.Forms.Application.EnableVisualStyles()
If My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5", "Version", Nothing) Is Nothing Then
System.Windows.Forms.MessageBox.Show("The .Net Framework 3.5 was not found. test_mail_autre can't start without it. Please install the .Net Framework 3.5 and try again.", "test_mail_autre", MessageBoxButtons.OK, MessageBoxIcon.Error)
System.Diagnostics.Process.Start("http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=fr")
End
End If
My.Resources.Culture = Globalization.CultureInfo.InvariantCulture : My.Resources.Culture = My.Resources.Culture
System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(False)
For Each arg As String In System.Environment.GetCommandLineArgs
If Not arg = System.Windows.Forms.Application.ExecutablePath Then
Redim Preserve ALL_ARGUMENTS_APPLICATIONS(ALL_ARGUMENTS_APPLICATIONS.Length) : ALL_ARGUMENTS_APPLICATIONS(ALL_ARGUMENTS_APPLICATIONS.Length - 1) = arg
End If
Next
System.Windows.Forms.Application.Run(New WindowsForm1_f)
End Sub
End Class
Public Module VARIABLES_AZERTY_ABCDE_ALPHA_BETA_DELTA_SOFTWAREZATOR_VARIABLES
Public VARIABLES_SOFTWAREZATOR_CURRENT_PLUGIN_VARIABLES As String
Public NetworkCredential As Object '
Public MsgBox As Object '
Public ALL_ARGUMENTS_APPLICATIONS() As Object = New Object(-1){}
Public ALLUSERPROFILE As Object = CStr(Environment.GetEnvironmentVariable("ALLUSERPROFILE"))
Public APPDATA As Object = CStr(Environment.GetEnvironmentVariable("APPDATA"))
Public CLASSPATH As Object = CStr(Environment.GetEnvironmentVariable("CLASSPATH"))
Public CommonProgramFiles As Object = CStr(Environment.GetEnvironmentVariable("CommonProgramFiles"))
Public COMPUTERNAME As Object = CStr(Environment.GetEnvironmentVariable("COMPUTERNAME"))
Public ComSpec As Object = CStr(Environment.GetEnvironmentVariable("ComSpec"))
Public FP_NO_HOST_CHECK As Object = CStr(Environment.GetEnvironmentVariable("FP_NO_HOST_CHECK"))
Public HOMEDRIVE As Object = CStr(Environment.GetEnvironmentVariable("HOMEDRIVE"))
Public HOMEPATH As Object = CStr(Environment.GetEnvironmentVariable("HOMEPATH"))
Public LOCALAPPDATA As Object = CStr(Environment.GetEnvironmentVariable("LOCALAPPDATA"))
Public LOGONSERVER As Object = CStr(Environment.GetEnvironmentVariable("LOGONSERVER"))
Public NUMBER_OF_PROCESSORS As Object = CStr(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"))
Public OS As Object = CStr(Environment.GetEnvironmentVariable("OS"))
Public PATH As Object = CStr(Environment.GetEnvironmentVariable("PATH"))
Public PATHEXT As Object = CStr(Environment.GetEnvironmentVariable("PATHEXT"))
Public PROCESSOR_ARCHITECTURE As Object = CStr(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"))
Public PROCESSOR_IDENTIFIER As Object = CStr(Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"))
Public PROCESSOR_LEVEL As Object = CStr(Environment.GetEnvironmentVariable("PROCESSOR_LEVEL"))
Public PROCESSOR_REVISION As Object = CStr(Environment.GetEnvironmentVariable("PROCESSOR_REVISION"))
Public ProgramData As Object = CStr(Environment.GetEnvironmentVariable("ProgramData"))
Public ProgramFiles As Object = CStr(Environment.GetEnvironmentVariable("ProgramFiles"))
Public [PUBLIC] As Object = CStr(Environment.GetEnvironmentVariable("PUBLIC"))
Public SESSIONNAME As Object = CStr(Environment.GetEnvironmentVariable("SESSIONNAME"))
Public SystemDrive As Object = CStr(Environment.GetEnvironmentVariable("SystemDrive"))
Public SystemRoot As Object = CStr(Environment.GetEnvironmentVariable("SystemRoot"))
Public TEMP As Object = CStr(Environment.GetEnvironmentVariable("TEMP"))
Public TMP As Object = CStr(Environment.GetEnvironmentVariable("TMP"))
Public USERDOMAIN As Object = CStr(Environment.GetEnvironmentVariable("USERDOMAIN"))
Public USERNAME As Object = CStr(Environment.GetEnvironmentVariable("USERNAME"))
Public USERPROFILE As Object = CStr(Environment.GetEnvironmentVariable("USERPROFILES"))
Public windir As Object = CStr(Environment.GetEnvironmentVariable("windir"))
End Module
Public Module VARIABLES_AZERTY_ABCDE_ALPHA_BETA_DELTA_FORMS_SOFTWAREZATOR_VARIABLES
Private _WindowsForm1 As WindowsForm1_f = New WindowsForm1_f
Public Property WindowsForm1 As WindowsForm1_f
Get
Return _WindowsForm1
End Get
Set(ByVal value As WindowsForm1_f)
_WindowsForm1 = value
End Set
End Property
End Module
Partial Public Class WindowsForm1_f
Public Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles button1.Click
Try
Imports System.Net
Private Function EnvoyerMail() As Boolean
' Définition des variables
Dim objMessage As System.Net.Mail.MailMessage
Dim objSMTPClient As System.Net.Mail.SmtpClient
Try
' définition du message
objMessage = New System.Net.Mail.MailMessage()
' Adresse email de l'expéditeur
objMessage.From = New System.Net.Mail.MailAddress("ADR_HIDE.com")
' Adresse email des destinataires
objMessage.To.Add("ADR_HIDE")
objMessage.To.Add("ADR_HIDE")
' message
objMessage.Subject = "Sujet du message"
objMessage.Body = "Corp du message"
objMessage.IsBodyHtml = False
' définition du serveur et envoie
objSMTPClient = New System.Net.Mail.SmtpClient("SMTP.gmail.com", 587)
objSMTPClient.EnableSsl = True
objSMTPClient.Credentials = New NetworkCredential("login_HIDE", "passe_HIDE")
objSMTPClient.Send(objMessage)
MsgBox("Ok")
Catch ex As Exception
MsgBox("Exception : " & ex.Message)
End Try
End Function
Catch err As Exception
System.Windows.Forms.MessageBox.Show(Err.Message, "test_mail_autre", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class
End Namespace
Namespace My.Resources
'Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder.
'''<summary>
''' Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Public Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Public ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("test_mail_autre.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Remplace la propriété CurrentUICulture du thread actuel pour toutes
''' les recherches de ressources à l'aide de cette classe de ressource fortement typée.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
' Définition des variables
Dim objMessage As System.Net.Mail.MailMessage
Dim objSMTPClient As System.Net.Mail.SmtpClient
' définition du message
objMessage = New System.Net.Mail.MailMessage()
' Adresse email de l'expéditeur
objMessage.From = New System.Net.Mail.MailAddress("ADR_HIDE.com")
' Adresse email des destinataires
objMessage.To.Add("ADR_HIDE")
objMessage.To.Add("ADR_HIDE")
' message
objMessage.Subject = "Sujet du message"
objMessage.Body = "Corp du message"
objMessage.IsBodyHtml = False
' définition du serveur et envoie
objSMTPClient = New System.Net.Mail.SmtpClient("SMTP.gmail.com", 587)
objSMTPClient.EnableSsl = True
objSMTPClient.Credentials = New System.Net.NetworkCredential("login_HIDE", "passe_HIDE")
objSMTPClient.Send(objMessage)
MsgBox("Ok")
Dim objMessage As System.Net.Mail.MailMessage
Dim objSMTPClient As System.Net.Mail.SmtpClient
objMessage = New System.Net.Mail.MailMessage()
objMessage.From = New System.Net.Mail.MailAddress("ADR_HIDE.com")
objMessage.To.Add("ADR_HIDE")
objMessage.To.Add("ADR_HIDE")
objMessage.Subject = "Sujet du message"
objMessage.Body = "Corp du message"
objMessage.IsBodyHtml = False
objSMTPClient = New System.Net.Mail.SmtpClient("SMTP.gmail.com", 587)
objSMTPClient.EnableSsl = True
objSMTPClient.Credentials = New System.Net.NetworkCredential("login_HIDE", "passe_HIDE")
objSMTPClient.Send(objMessage)
Dim data As System.Net.Mail.Attachment = New System.Net.Mail.Attachment(Fichier)
Dim disposition As System.Net.Mime.ContentDisposition = data.ContentDisposition
disposition.CreationDate = System.IO.File.GetCreationTime(Fichier)
disposition.ModificationDate = System.IO.File.GetLastWriteTime(Fichier)
disposition.ReadDate = System.IO.File.GetLastAccessTime(Fichier)
objMessage.Attachments.Add(data)