|
-
Feb 3rd, 2008, 06:33 PM
#1
Thread Starter
Addicted Member
send email attachment
Hi gurus
I have the following code that put together with all your help, It works fine sending email but once I want to send an attachment it just dont do it, no error is given,the application does not crash, just the email with the attachment not been sent or at least not been getting by the account.
as you can see I am using sbcglobal to send my emails
Thanks for any help gurus
Code:
Dim filetosend As New System.Web.Mail.MailAttachment("c:\file.txt")
Try
Dim emailaccount As New System.Web.Mail.MailMessage
emailaccount.To = "[email protected]"
emailaccount.From = "[email protected]"
emailaccount.Body = " "
emailaccount.Subject = "my attachment"
emailaccount.Attachments.Add(filetosend)
email.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "mail.sbcglobal.net"
System.Web.Mail.SmtpMail.Send(emailaccount)
Catch ex As Exception
MsgBox(ex.Message)
End Try
-
Feb 3rd, 2008, 07:10 PM
#2
Re: send email attachment
Are you using .NET 1.x or a later version? If it's a later version then you should be using System.Net.Mail rather than System.Web.Mail.
That said, if it works fine without attachments and you get no errors with an attachment then I'd suggest that there's nothing wrong with the code as far as it's being correct. I'd suggest that either the SMTP server is not allowing your attachment for some reason or else the firewall at the other end is snaffling it. Have you tried sending the same attachment from your own mail client to the same address? Does it get through?
-
Feb 3rd, 2008, 07:34 PM
#3
Thread Starter
Addicted Member
Re: send email attachment
J.
Thanks a bunch, using 2003 Fw 1.1, I will give your suggestion a try, but using their client I know it works as I have done it many times, is when I use VB that I does not work.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|