Closed Thread
Results 1 to 6 of 6

Thread: Send HTML email with Text Boxes

  1. #1
    pu8y is offline Newbie
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Send HTML email with Text Boxes

    Hi,

    I want to make a send email function which display Text Boxes in the email content so that my receipents can fill in accordingly. However, besides the auto-generated Text Boxes, the sender also need to type-in some information before the mail is sent out. So once I click on the "EMAIL" button in my vb form, the Text Boxes and some information is auto-generated. The sender is able to see these info+TextBoxes before he/she clicks SEND to send the email out.

    My Problem:
    1) Initially i did it with CreateObjebct("Outlook.Application") to automate Microsoft Outlook application. It works by i construct the Text Boxes and info and put them into HTML tags. However the users only have Outlook Express but not Microsoft Outlook so this method is out.

    2) I tried another method which I send Email With MAPI Components. However, I had been told that MAPI doesn't support HTML email

    3) Now, i used vbSendMail.dll and SMTP server to send the email since it support the HTML. However, it displays the HTML tags and it is hard to read by users whose dont know about HTML since they need to type/add on information to the email content.

    Any idea on what will be the best solution for this probem?
    Attached Thumbnails Attached Thumbnails Send HTML email with Text Boxes-smtp.jpg  

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Aug 2007
    Location
    Gizeh, Al Jizah, Egypt, Egypt
    Posts
    8,675
    Blog Entries
    12
    Rep Power
    81

    Re: Send HTML email with Text Boxes

    i dont know ho to do this in visual basic, but your email is missing the headers that tell the email-system that you are sending HTML formatted text
    the header should be like this:
    Code:
    MIME-Version: 1.0
    Content-Type: text/html
    yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
    Code:
    eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
    www.amrosama.com | the unholy methods of javascript

  4. #3
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: Send HTML email with Text Boxes

    I don't actually know anything about VB but a quick search found this: Code Beach - Creating and sending HTML email in Visual Basic - Part 1.

    Hope that helps.

  5. #4
    cdg10620's Avatar
    cdg10620 is offline Programming Expert
    Join Date
    Jun 2009
    Location
    Texas
    Posts
    387
    Blog Entries
    3
    Rep Power
    12

    Re: Send HTML email with Text Boxes

    This is a method that I have used before. This is in a VBScript file that runs with a scheduled task. I am passing a RecordSet object to the method.

    Code:
    Sub SendSMTPMessage(oRs)
    	Dim inx, EMail, sMsgText, sResult
    	Set EMail = CreateOBject("CDO.Message")
    
    	Email.From = "someone@somewhere.com"
    	EMail.Subject = "Subject"	
    	EMail.To = "someone@somewhere.com" 'or you can use an array of people
    	
    	Email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "serverAddress"
    	Email.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    	Email.Configuration.Fields.Update
    	
    	sMsgText = "Enter your message text here"
    	
    	EMail.HtmlBody = sMsgText
    	sResult = EMail.Send
    	
    	Set Email = Nothing
    End Sub
    Your HTML would go inside quotes where the sMsgText is. Hope this helps.
    -CDG10620
    Software Developer

  6. #5
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: Send HTML email with Text Boxes

    Make a php script that accepts parameters with GET, host it online, from the vb application execute the url from the vb application and send the parameters from the url (so the php wil GET them and send the email )

  7. #6
    -Steve-'s Avatar
    -Steve- is offline Newbie
    Join Date
    Sep 2009
    Posts
    4
    Rep Power
    0

    Re: Send HTML email with Text Boxes

    Oh after pasting the code in here i realized you said html email, not smtp, sorry. but here it is anyways
    Code:
    Try
                Dim Guser As String
                Dim Gpass As String
                Guser = "email username" & "@gmail.com"
                Gpass = "email password"
    
                    Dim mail As New MailMessage()
                    Dim SmtpServer As New SmtpClient
                    SmtpServer.Credentials = New Net.NetworkCredential(Guser, Gpass)
                    SmtpServer.Port = 587
                    SmtpServer.Host = "smtp.gmail.com"
                    SmtpServer.EnableSsl = True
                    SmtpServer.EnableSsl = True
                    mail.To.Add(Guser)
                    mail.From = New MailAddress(Guser)
                    mail.Subject = "LeetCoders.org"
                    SmtpServer.Send(mail)
    catch ex as exception
    messagebox.show(ex.tostring)
    end try
    Have a great day

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. send email from my application
    By issacthiyagarajan in forum PHP Development
    Replies: 1
    Last Post: 06-23-2010, 04:02 AM
  2. Python Send An Email
    By QuackWare in forum Classes and Code Snippets
    Replies: 0
    Last Post: 03-07-2010, 07:18 PM
  3. Send Email Via SMTP
    By VBnet in forum Visual Basic Tutorials
    Replies: 3
    Last Post: 01-22-2010, 10:05 AM
  4. Send email attachment
    By cakka in forum PHP Development
    Replies: 2
    Last Post: 03-25-2009, 01:47 AM
  5. send email >>>>>but!!!!
    By kiss in forum Visual Basic Programming
    Replies: 7
    Last Post: 01-10-2008, 05:44 AM

Tags for this Thread

Bookmarks

Posting Permissions

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