Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Send email thru vb.net with attachment
Message
 
À
05/01/2005 09:30:35
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00974371
Message ID:
00974475
Vues:
19
You cannot use the short version to send e-mails with attachements.

It will be something like this:
                objMessage = New MailMessage()
                With objMessage
                    .From = Me.MailFrom
                    .To = Me.MailTo
                    .Cc = Me.MailCC
                    .Bcc = Me.MailBCC
                    .Subject = Me.MailSubject
                    .Body = Me.MailBody
                    .BodyEncoding = Me.MailBodyEncoding
                    .BodyFormat = Me.MailBodyFormat
                    .Priority = Me.MailPriority

                    Dim strAttach As String
                    strAttachments = Me.MailAttachments
                    For Each strAttach In strAttachments.Split(";"c)
                        If File.Exists(strAttach) Then
                            .Attachments.Add(New MailAttachment(strAttach))
                        End If
                    Next
                End With
                SmtpMail.SmtpServer = Me.SMTPServer()
                SmtpMail.Send(objMessage)
You need to add files one by one using this:
>Hi .. All,
>
>I need to send email thru my vb.net app, what I don't understand is how to attach some files to email by using my vb.net 's codes below:
>
>Imports System.Web.Mail
>
> Public Sub SendMail(ByVal pRecepient As String, ByVal pSubject As String, ByVal pBody As String)
> If pubSendMail = True Then
> System.Web.Mail.SmtpMail.SmtpServer = pubMailServer
> System.Web.Mail.SmtpMail.Send( _
> pubEmailAddress, pRecepient, pSubject, pBody)
> End If
> End Sub
>
>please advise .. thanks
>
>Regards
>Winanjaya
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform