Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Errors (Invalid email attachment)
Message
From
09/08/2003 22:48:31
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Errors (Invalid email attachment)
Miscellaneous
Thread ID:
00818641
Message ID:
00818641
Views:
56
I used below codes for sending email thru asp.net, everything goes ok if I send email without file attachment.. and I will met error "Invalid mail attachment" If file attached ..am I missing something inside the codes? ..
could any body please help me ? .. many thanks in advance

Imports System.Web.Mail
Public Sub SendEmail(ByVal pTo As String, ByVal pSubject As String, ByVal pBody As String, ByVal pAttachment As String)
Dim objMail
Dim mailMessage As New MailMessage()
Dim mFrom As String
Dim mSMTPServer As String
mSMTPServer = ConfigurationSettings.AppSettings("mSMTPServerName")
mFrom = ConfigurationSettings.AppSettings("mFromForgotPassword")
If Len(Trim(mSMTPServer)) > 0 And Len(Trim(mFrom)) > 0 Then
mailMessage.From = mFrom
mailMessage.To = pTo
mailMessage.Subject = pSubject
mailMessage.BodyFormat = Mail.MailFormat.Text
mailMessage.Body = pBody
If Len(Trim(pAttachment)) > 0 Then
Dim mAttachment As New MailAttachment("C:\WINAN1.TXT")
mailMessage.Attachments.Add(mAttachment)
End If
SmtpMail.SmtpServer = mSMTPServer
SmtpMail.Send(mailMessage)
End If
End Sub


Regards
Winan
Next
Reply
Map
View

Click here to load this message in the networking platform