Results 1 to 6 of 6

Thread: send EMAIL without outlook, or anything like that [vb6]

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    9

    send EMAIL without outlook, or anything like that [vb6]

    Hello,

    i am currently making a game, and when you register, the user will need to validate their email to continue playing, so that i want to do is when they click the submit button, it will save all the nessessary information and send a email with their validation code, so i dont want outlook to open, or anything like that, just send the email directly and thats all. can i get some help with this, i am very new to network programming with vb

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: send EMAIL without outlook, or anything like that [vb6]

    You probably meant Outlook Express, but that's besides the point. Same issues.

    You need to avoid MAPI calls. You can rely on CDO for Windows which is in Win2K and later or you can use a 3rd party component or you can code SMTP logic against the Winsock control.

    All of these mean a new headache.

    Many ISPs will block port 25 SMTP traffic. Others will proxy it to their own SMTP server, which will require valid user credentials. There are some mail hosting providers that allow SMTP over an alternate port... though this too might be blocked for some of your users.


    At the end of the day you'll probably need to do what everyone else has had to do: use HTTP over port 80. The easiest way is probably to use a web hosting service that lets you accept input via a web form and then send a generated email from their own SMTP server. Often they have simple page templates to get you started.

    Your "page" may not have to even exist! Some of them simply provide a "location" your "page" is supposed to POST the data to. Just use some HTTP component in your program that can POST, and have your program format the POST request to look as if it came from your "web page" (that doesn't have to exist).

    The good news?

    Works for pretty much anybody with an active Internet connection. You don't need to know anything about SMTP.

    The bad news?

    You might need to learn a little about how HTML forms actually work.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    9

    Re: send EMAIL without outlook, or anything like that [vb6]

    ah, finally an answer, and thankyou, fortunately i know the basics of HTML, but not the more advanced things... could you by chance walk me through it?

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: send EMAIL without outlook, or anything like that [vb6]

    The idea here is to avoid dealing with email at all in your program. Instead this technique "remotely" sends email by sending an HTTP request to a web server that will in turn send the actual email.

    Keep in mind that if the web server involved is under your direct control you could simply post the information directly into some database, append it to a text file, etc. When using a web site at a hosting service though sending the information on to yourself as email messages can be a handy alternative.

    On the surface there isn't much to this:
    • Have an "email" or "guestbook" type form on a web server, set to send completed forms as an email to some email address you have.
    • In your VB program assemble the bits of information needed to complete this web feedback form.
    • Format this information properly as the body of an HTTP form POST request.
    • POST the information to the server URI that accepts the feedback form input using the Internet Transfer control, XMLHTTPRequest object, Winsock control (with some extra logic to handle the HTTP protocol), or some other component or API.

    At the server side you could use ASP, PHP, CGI, or whatever. You just need something there that will take the submitted "form" data and construct an email message to send on to your mailbox. Of course this server-side logic needs to reach an SMTP server, but you set this up once just for the server logic.

    Free web hosting services might even offer what you need. If you have a web site now you might already have everything you need. Often a "canned" CGI, etc. is offered for guestbook/feedback emails.

    Some more detail on doing an HTTP POST can be found at The POST Method as well as many other places on the Web.

    Resist suggestions to use the WebBrowser control or an automated instance of IE for this. Those are heavyweight solutions that rely on the user not having crippled IE by setting goofy options for browser security, etc. You also risk exposing your users to browser hijacks and other browser-exploiting malware.

    The Inet control should work fine for something this simple. Just be sure you set the proper Content-Type header and that you URL-encode the "submitted" name/value data before stringing it together with = and & symbols.

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: send EMAIL without outlook, or anything like that [vb6]

    Looking back I see I've been pretty clever... at perhaps answering the wrong question.

    I thought you wanted your VB program to send YOU an email when some action was performed.


    Re-reading your original question (with my eyes fully open) it sounds like you want to do something entirely different. It looks as if you want the user to "register" (via some undefined process), then you want to create a validation code, and you want to email this out to the user.

    This is a completely different proposition from having your VB game run by a user send an email to you!


    It sounds like your question is less about emailing and more like "How do I build a registration process?"

    Sorry to have taken you off into the weeds.

    Don't you think you'd want to use the web for this? What have you built so far? How do the users "register" in your scheme?

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: send EMAIL without outlook, or anything like that [vb6]

    Martin Liss has posted a very nice registration system on the site. You can find it here.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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