Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[4287] Sending Email With an Attachment

Last post 07-21-2008 6:28 PM by k.ashish. 21 replies.
Page 1 of 2 (22 items) 1 2 Next >
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [4287] Sending Email With an Attachment

    This thread is for discussions of Sending Email With an Attachment.

    • Post Points: 70
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 02-12-2004 6:18 PM In reply to

    • dman2003
    • Not Ranked
    • Joined on 02-12-2004
    • New Member
    • Points 15

    Newby question

    I am pretty new to VB.net programming and I seem to be missing a critical element to understanding how to use these code samples. For example the code below taken from this site does not work for me. VB underlines the two items surrounded by **** in the sample code below and says that "type Mail Attachement is not defined" also says that "name smtpMail is not declared"

    What am I missing - each time I try to download sample code I run into the same types of issues????

    Thanks!

    Dim oMsg As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()

    oMsg.From = "noone@nobody.com"
    oMsg.To = "someone@somewhere.com"
    oMsg.Subject = "Email with Attachment Demo"
    oMsg.Body = "This is the main body of the email"
    Dim oAttch As ****MailAttachment**** = New MailAttachment("C:\myattachment.zip")
    oMsg.Attachments.Add(oAttch)
    ****SmtpMail.Send****(oMsg)
    • Post Points: 0
  • 06-30-2004 5:24 PM In reply to

    • kid
    • Not Ranked
    • Joined on 06-30-2004
    • New Member
    • Points 5

    nOObe

    Do I double click the forum to enter this code?
    AND PLEASE KEEP THE TUTORIALS ON THIS COMING!!
    javascript:smilie('')
    javascript:smilie('')
    • Post Points: 0
  • 11-09-2004 7:57 PM In reply to

    • Ramak
    • Not Ranked
    • Joined on 11-09-2004
    • New Member
    • Points 5

    PDA program in .NET compact

    Hi,

    I am using XML Text reader in PDA application to read large XML file, its working in Emulator but not in the PDA device. SO if any body can give suggetion, I will be thankful.

    Ramakrishna Tulluri
    India
    • Post Points: 0
  • 11-28-2004 2:21 PM In reply to

    Help from The Jackal

    First Add Reference to System.Web.Dll
           Go to top Menu
           -Project
             -Add References

           Select System.Web.dll

    Use this Coding
           oMsg.From = Me@Here.com"
           oMsg.To = "He@There.com"
           oMsg.Subject = "Dit is my Afrikaanse Boodskap"
           oMsg.Body = "Ek wil dit bysit"
           Dim oAttch As System.Web.Mail.MailAttachment = New System.Web.Mail.MailAttachment("C:\ftpfile.txt")
           oMsg.Attachments.Add(oAttch)
           System.Web.Mail.SmtpMail.Send(oMsg)
           MessageBox.Show("Mail Message Send")
    • Post Points: 0
  • 02-18-2005 11:05 PM In reply to

    SendEmail

    One thing about this code - I am trying to send with a specific SMTP server and Need to utilize the appropriate Authentication to use that SMTP server..
    Any Ideas on how to do that ?
    I know I can specify the SMTP server but how do I Specify the Authentication (username and password) obviously I might not want to send this in the clear..Can anyone help ..
    • Post Points: 0
  • 04-09-2005 5:05 AM In reply to

    reg. System.web.mail

    I can't get System.Web.Mail name space on my system. Is there any installation problem??

    Ram Kinkar Pandey
    PRamkinkar@pisoftek.com
    Priya International Softek Limited
    India
    Software Engineer
    NOIDA, India
    • Post Points: 10
  • 04-18-2005 3:27 AM In reply to

    Question

    ok ive tried this code but it is not working, i keep getting the error----

    <An unhandled exception of type 'System.Web.HttpException' occurred in system.web.dll>
    <Additional information: Could not access 'CDO.Message' object.>

    Please Help!!!
    Kinghenery87@aol.com
    • Post Points: 0
  • 06-08-2005 9:39 PM In reply to

    Trying to attach to oMsg.Body and richtextbox.text

    I have tried to attach to oMsg.Body a richtexbox text.
    I found that it doesn't work this way. I presume is because I have to send html formated text or plain text.
    But still, I would like to send formated texts (from my app) in order to have well designed e-mails to my receivers.
    How I amm supposed to accomplished that?
    • Post Points: 0
  • 09-14-2005 9:43 PM In reply to

    • MahR
    • Top 25 Contributor
    • Joined on 08-27-2004
    • Guru
    • Points 3,530

    pretty simple!

    The code is simple and works fine with me!!!
    Mohammad Adil Hussain Raza
    VB6, HTML, ASP Developer, Graphic Designer
    For Urdu Active-X Controls: Click Here
    ----------------------------------------------
    Translation of word "Islam" in English is "Peace".
    ----------------------------------------------
    • Post Points: 0
  • 10-25-2005 8:33 AM In reply to

    • Ammar
    • Not Ranked
    • Joined on 10-25-2005
    • New Member
    • Points 10

    SMTP Mail with authentication

           Dim objSender As SmtpMail
           objSender.SmtpServer = "SMTPMAILSERVER"
           Dim objMsg As New MailMessage
           objMsg.From = "email@server.com"
           objMsg.To = "email@server.com"
           objMsg.Subject = "Test HTML"
           objMsg.BodyFormat = MailFormat.Html
           objMsg.Body = "<html><h1>hello</h1></html>"
           ''
           objMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtsperver") = "SMTPMAILSERVER"
           objMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
           objMsg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
           objMsg.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
           objMsg.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "SMTPUSERNAME"
           objMsg.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "SMTPPASSWORD"
           ''
           objSender.Send(objMsg)
    • Post Points: 10
  • 10-26-2005 6:37 AM In reply to

    Sending Email

    I have seen this format before and I believe that format is for VB System not a Web App - I am not sure if I stated my question clearly enough.

    I am using .NET
    from the client side I want to be able to send an email and specify the email server username and password.


    I will retry that code just to be sure - I posted the message a while back and cant remember much..
    • Post Points: 0
  • 10-26-2005 8:14 AM In reply to

    • Ammar
    • Not Ranked
    • Joined on 10-25-2005
    • New Member
    • Points 10
    hi

    you can keep that code any where its not a problem whether a webpage calls it or a windows app.

    whats important is that it works on the .net framework.

    do you mean by client side, that you use javascript, if yes, you can use AJAX to call a function from the server side, without any trip to the server.

    Regards


    • Post Points: 0
  • 10-26-2005 4:54 PM In reply to

    Thanks

    Great Thanks
    • Post Points: 0
  • 06-16-2006 11:47 AM In reply to

    Re: reg. System.web.mail

    all u hav to do is add reference "System.web.dll" in ur project...

    that u can do by :----

    1) rite - clickin on ur project in da solution explorer and click on 'add reference'...

    2) got to da 'COM' tab and add the dll i mentioned before...Smiley Face [:)]

    njoi...!!!Smiley Face [:)]

    • Post Points: 5
Page 1 of 2 (22 items) 1 2 Next >