|
-
Jun 30th, 2005, 06:05 AM
#1
Thread Starter
Addicted Member
Very simple emails from vb6
In my application i need to have the facility to sedn a smiple email to a team leader regrading the booking of time off by an adviser. The email client to be used is outlook and all the poeple on the network are conatced by ther full names. i want to have a form which has hidden boxes whihc conatin the recipents name based on a previous query (this has all gone ok) now I just need a simple bit of code that sends a simple message.. "adviser booked timer off" follwoed by the dates taken from 2 text boxes on the from. It then needs to send the email just using outlook.. its not nessasary to see outlook at all as it will be running in the background of every users pc. When i built the mock up in access it simply used the send to command but this is giving me real hastle.. i keep finding examples but they all seem to complex.. i need something very very simple... if anyone can point me in the right direction..
sean
-
Jun 30th, 2005, 06:06 AM
#2
Re: Very simple emails from vb6
You don't actually have to use Outlook to send the emails. Search the forums, this question has been asked many a time..If nothing satisfies, Planet Source Code is chock full of Email examples.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jun 30th, 2005, 06:12 AM
#3
Re: Very simple emails from vb6
Use Outlook from VB is no more complicated than using Word or Excel from VB. Are you doing this project in VB or Access VBA?
-
Jun 30th, 2005, 06:17 AM
#4
Thread Starter
Addicted Member
Re: Very simple emails from vb6
im using an access db with a vb front end
-
Jun 30th, 2005, 06:37 AM
#5
Re: Very simple emails from vb6
In your first post, you said that you had seen examples of using Outlook, so I think it would be redundant to post one as whatever I would post would doubtless mirror what you have already seen.
So, let me ask, what is it about the examples that you find 'complex'? Perhaps we can straighten the issues out a little and simplify things.
-
Jun 30th, 2005, 06:56 AM
#6
Thread Starter
Addicted Member
Re: Very simple emails from vb6
ive tried simple ones but i get errors saying activex cannot open outlook.. ive deleted the code now so i cant remember exactly.. im trtying a piece of code from planet source code now so ill see what happens and ill post thye code so others can see
-
Jun 30th, 2005, 07:08 AM
#7
Thread Starter
Addicted Member
Re: Very simple emails from vb6
Ok i tried using this code but i get the error 2run time 429, activex component cant create object??
VB Code:
Private Sub cmdMailSend_Click()
Dim olapp As Object
Dim oitem As Object
Set olapp = CreateObject("Outlook.Application")
Set oitem = olapp.CreateItem(0)
With oitem
.Subject = "Test Email Using VB and Outlook Object"
.Body = "This message was sent from VB"
.Send
End With
Set olapp = Nothing
Set oitem = Nothing
Exit Sub
End Sub
Last edited by ricodstar; Jun 30th, 2005 at 07:11 AM.
-
Jun 30th, 2005, 07:13 AM
#8
Re: Very simple emails from vb6
Your code worked fine for me.
I believe your problem is that you need to set a reference to the Microsoft Outlook Object Library.
Try that, and then rerun your code.
-
Jun 30th, 2005, 07:17 AM
#9
Thread Starter
Addicted Member
Re: Very simple emails from vb6
ive got microsoft outlook 11.0 objetc libary referenced and it still wont work? does it have anything to do with where outlook is saved on my pc?
-
Jun 30th, 2005, 07:23 AM
#10
Re: Very simple emails from vb6
It shouldn't.
I put together a sample project using your code that works on my PC. I used my own EMail address in the .To part, and then changed it back to the sample after I received the mail message.
I'm attaching it. Modify it to use your email address and see what happens.
-
Jun 30th, 2005, 11:02 AM
#11
Thread Starter
Addicted Member
Re: Very simple emails from vb6
Hi ive just tried it and i get the same issue... could it be to do with outlook on my pc...?
-
Jun 30th, 2005, 01:03 PM
#12
Re: Very simple emails from vb6
Here is a simple email that works with this ISP. You could use any smtp host that you want, but this one was working for me even a few weeks ago.
http://vbforums.com/attachment.php?attachmentid=37741
-
Jul 1st, 2005, 04:44 AM
#13
Thread Starter
Addicted Member
Re: Very simple emails from vb6
Ok, im trying to write a line of code that says an advsier on your team has booked time off the details are as follows:" name = text2, date from = text3 and date until = text4,
The results are to be sent in an email but i cant get this string write, below is how i tried to write it:
Code:
.body = "An adviser on yout team has tried to book time off, the details are below:" and "Name" = text2.text and "Date from" = text3.text and "Date Until" = text4.text
any ideas??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|