Jishnu 160 Posting Pro

Hello,

I'm using MAPI component to send email messages via VB6. Here's my code:

Option Explicit

Private Sub cmdEnd_Click()
	Unload Me
End Sub

Private Sub cmdSend_Click()
	MAPISession1.SignOn
	MAPISession1.DownLoadMail = False
	DoEvents
	MAPIMessage1.SessionID = MAPISession1.SessionID
	MAPIMessage1.Compose
	MAPIMessage1.RecipAddress = txtSendTo.Text
	MAPIMessage1.ResolveName
	MAPIMessage1.MsgSubject = txtSubject.Text
        MAPIMessage1.MsgNoteText = txtMessage.Text
        MAPIMessage1.Send False 
        MAPISession1.SignOff
End Sub

Private Sub Form_Load()
	Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub

Private Sub txtSendTo_GotFocus()
	txtSendTo.SelStart = 0
	txtSendTo.SelLength = Len(txtSendTo)
End Sub

When I run it, I've to enter data in the fields 'To', 'Subject' and 'Message'. When I click on 'Send', a prompt appears which says, "A program is attempting to send the following email message on your behalf, <Details of the message>, Would you like to send the message?" There are two buttons, 'Send' and 'Do not send'. The currently selected button is 'Send'. I want to automate the process of selecting the appropriate action i.e. sending or not sending the message. I want to change my code so that this action is dealt with from the code itself.

I'd thought that inserting ascii values for characters like tab key and enter key in the keyboard buffer after a certain delay would solve the problem. But I don't know how to implement the same. Also, I'd like to know is there any other easier way to achieve the same?

Regards,
Jishnu.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.