Send email attachment
-
Hi - How would we send email attachments from a web form? I tried: Dim fileattachment_1 = file.PostedFile Dim strPath As String strPath = Path.GetFullPath(fileattachment_1.Filename) objAttach = New MailAttachment(strPath) msg.Attachments.Add(objAttach) And then sent it. Many thanks.
-
Hi - How would we send email attachments from a web form? I tried: Dim fileattachment_1 = file.PostedFile Dim strPath As String strPath = Path.GetFullPath(fileattachment_1.Filename) objAttach = New MailAttachment(strPath) msg.Attachments.Add(objAttach) And then sent it. Many thanks.
HI there. You'll have to save the
PostedFile
to the server's disk first, then use the absolute path of the saved file when creating yourMailAttachment
. -
Hi - How would we send email attachments from a web form? I tried: Dim fileattachment_1 = file.PostedFile Dim strPath As String strPath = Path.GetFullPath(fileattachment_1.Filename) objAttach = New MailAttachment(strPath) msg.Attachments.Add(objAttach) And then sent it. Many thanks.
You may need to called PostedFile.SaveAs (to a temporary File location). Perhaps you can use Temporary Path. Then send the attachment. After the email is sent, you can delete the file. Vasudevan Deepak Kumar Personal Web: http://www.lavanyadeepak.tk/ I Blog At: http://www.dotnetjunkies.com/weblog/deepak/
http://deepakvasudevan.blogspot.com/
http://deepak.blogdrive.com/