Filling in the Body of an email

drlease2000
11-12-2001, 01:33 PM
I have been trying to figure out what I'm doing wrong on this one. It seems that it should work. What I have is a vb form that is logging information (ie Customer Name, Company Name, address.......) and writing it to a file. When the User Submits this info, it creates the file and then launces the default email client to send that information back to me. The part I'm having problems with is getting my program to take the info that is in the registration file created by the app and sticking it into the BODY of the email to send to me. Here's what I've tried with no success.

Private Sub btnSendInfo_Click()
FileNum = FreeFile
Open "C:\reg.txt" For Append As FileNum
Write #FileNum, txtCustomerName.Text, txtCompanyName.Text, txtCompanyAddress.Text, _
txtCompanyCity.Text, txtCompanyState.Text, txtCompanyZip.Text, _
txtCompanyPhone.Text, txtCompanyFAX.Text, txtCompanyEmail.Text
Close FileNum
FileNum = FreeFile
Open "C:\reg.txt" For Input As FileNum
EmailBody = Input(LOF(FileNum), FileNum)
Close FileNum
email = "Start mailto:drlease2000@msn.com"
email = email & "?Subject=Catalog CDROM Registration"
email = email & "&Body="
email = email & "EmailBody"
Shell (email), vbHide
End Sub

Although I'm sure there is a better way to do this, I can't see why this way doesî't work. All I get is a new email window with the "To" filled in and the first word of the "Subject" filled in. So I know some of it is working.

Please keep in mind that I'm new to this and the mere fact that I'm using 4.0 should reaffirm that fact. However any help at this point would be appreciated

robot313
11-12-2001, 06:36 PM
Hi. All you need to do is add underscores, which is this: _
to the subject instead of spaces and take the quotes off the EmailBody variable, like this: change this: email = email & "EmailBody"
to this: email = email & EmailBody

ChiefRedBull
11-13-2001, 03:55 PM
A perhaps simpler way is to use the raw SMTP method....

I've posted a tutor in the Tutors Corner on using the HotMail SMTP server.... its dead easy and quick.

Here (http://www.visualbasicforum.com/bbs/showflat.php?Cat=&Board=tu&Number=50321&page=0&view=collapsed&sb=5&o=1 86&fpart=)

Chief

robot313
11-13-2001, 04:41 PM
What if someone doesn't have a hotmail account? Will it still work?

ChiefRedBull
11-14-2001, 05:17 AM
Yes - you dont need to log into your hotmail account to use the service, therefore you dont need a hotmail account.

There are several other free SMTP servers around too.. try
<font color=red>mail.yahoo.com
mail.lycos.com
etc...
</font color=red>Also - search Google for a listing. Theres plenty.

Chief

robot313
11-14-2001, 10:11 AM
ok thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum