Results 1 to 13 of 13

Thread: Send Text To Email

  1. #1

    Thread Starter
    Banned
    Join Date
    Apr 2005
    Location
    C:\Documents And Settings\Dylan\Desktop
    Posts
    137

    Send Text To Email

    I made a windows form with a couple of text boxes. I want the user to click a send button and it automaticly sends it to my email without opening external programs such as outlook, etc. How would i do this?

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Send Text To Email

    you generally can't as there is no way to tell what mail they use, and if you can access their outgoing SMTP server to send email. Generally what I do in situations like this, is I would transmit data to a webpage, which would actually do the emailing, this way the only thing required of the end user is an internet connection. You pass the data using .net objects to the ASP or ASP.NET page, and it collects the data and emails it to you.

    This solution requires that you have a webhost, and one that has an email activeX (or similar) control that allows sending email via code. Most .NET or ASP hosts do allow that.

  3. #3
    Hyperactive Member jonwondering's Avatar
    Join Date
    May 2005
    Posts
    311

    Re: Send Text To Email

    what if you have a password and a username and every needed information about outgoing SMTP? is there a way to do it in vb.net?

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Send Text To Email

    yes.

    check out the 101 vb.net examples (sticky at the top of the .net forum)

    there is an example in there called "NET Framework - How-To Send Mail"

    that should give you everything you need. Its a full example app.

  5. #5
    Hyperactive Member jonwondering's Avatar
    Join Date
    May 2005
    Posts
    311

    Re: Send Text To Email

    Thanks buddy.

  6. #6
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Michigan
    Posts
    304

    Re: Send Text To Email

    kleinma,

    On my XP system, I was trying this example and found straight off that I don't have SMTP Service installed on my machine. Reading the Readme.htm, I try to find it by looking at Start | Control Panel | Administrative Tools | Internet Information Services, but I don't see Internet Information Services in Administrative Tools (perhaps hidden by our wonderful IT guys).

    How can I find the info I need in order to get this example running?

    EDIT: Looks like I may not have IIS installed according to this.

    http://www.webwizguide.com/asp/tutor..._winXP_pro.asp
    Last edited by fdunford; Aug 24th, 2005 at 09:17 AM.

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Send Text To Email

    do you have windows XP Pro? if so its really easy to install IIS onto your system... if you DO NOT have Pro and have home, then it does not come with IIS

    which do you have?

  8. #8
    Frenzied Member dinosaur_uk's Avatar
    Join Date
    Sep 2004
    Location
    Jurassic Park
    Posts
    1,098

    Re: Send Text To Email

    At the top of your form...

    VB Code:
    1. Imports System.Web.Mail

    Put this in your event.
    Subject is a string.
    emaillist is a string


    VB Code:
    1. 'Use SMTP
    2.                 Dim mail As New MailMessage
    3.                 With mail
    4.                     .To = EmailList
    5.                     .From = "[email protected]"
    6.                     .Subject = Subject
    7.                     .BodyFormat = MailFormat.Html
    8.                     .Body = Content
    9.                     .Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25") 'Put port number here
    10.                 End With
    11.                 System.Threading.Thread.Sleep(200)
    12.                 SmtpMail.SmtpServer = "122.122.122.122" 'your real server goes here
    13.                 System.Threading.Thread.Sleep(200)
    14.                 SmtpMail.Send(mail)
    If you find my thread helpful, please remember to rate me

  9. #9
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Michigan
    Posts
    304

    Re: Send Text To Email

    Quote Originally Posted by kleinma
    do you have windows XP Pro? if so its really easy to install IIS onto your system... if you DO NOT have Pro and have home, then it does not come with IIS

    which do you have?
    XP Pro, but have no CD's. If still possible, please tell.

  10. #10
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Michigan
    Posts
    304

    Re: Send Text To Email

    Quote Originally Posted by dinosaur_uk
    VB Code:
    1. Imports System.Web.Mail
    I can import System.Web, but Mail is not there? Using Help-About I have Microsoft Development Environment V 7.1.3088 and .NET Framework 1.1.4322. Does this mean I need a new version of Visual Studio .NET or Professional?

  11. #11
    Frenzied Member dinosaur_uk's Avatar
    Join Date
    Sep 2004
    Location
    Jurassic Park
    Posts
    1,098
    If you find my thread helpful, please remember to rate me

  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Send Text To Email

    Quote Originally Posted by fdunford
    I can import System.Web, but Mail is not there? Using Help-About I have Microsoft Development Environment V 7.1.3088 and .NET Framework 1.1.4322. Does this mean I need a new version of Visual Studio .NET or Professional?
    no you need to add a reference to system.web.dll in the .net references.

    Also NO, without the XP Pro CD, you will not be able to install IIS, you also will not be able to create asp.net applications if you wanted to, because you need IIS to make it work correctly in VS.

  13. #13
    Member
    Join Date
    Mar 2005
    Posts
    37

    Re: Send Text To Email

    I just call Blat when I want to send e-mail messages from a vb app. You can pass it both messages and attachments, and you can pass usernames and passwords as well, so you can send mail through ESMTP enabled servers.
    0000000100000010000000000000010100001001 reincarnated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width