Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best method to send mail?

Status
Not open for further replies.

violetstarlight

Programmer
Aug 7, 2002
23
US
I am working on a app that sends email from our salesman to their customers with marketing info in them. I am currently using CDO to send mail. Is this the best method? Either it or outlook or exchange...most likely outlook service pack... causes that dang blasted security popup saying that another app is trying to send mail and I can't get rid of it.

So the two questions on the table are:
1) Is CDO the best, most efficient way to send mail using VB 6?
2) And, are there any ways to avoid the security popup from outlook through code or a third party component or anything at all?
 
There are a lot of controls that let you send mail without going anywhere near any other mail programmes. I tried SMTP Mailer and DevMailer (think that was the name). Both worked well. Peter Meachem
peter @ accuflight.com

 
in a project of mine i used CDO with exchange to send mass mail and record the results in an SQL server and it worked fine.
 
when you used CDO with exchange, did it pop the "another app is trying to send mail, are you sure" security pop up msg?
 
Yes thats true but if you do not have your outlook open then everithing its ok
 
hey, if i understand u properly then use this code

Public sub CreateOLObject()

On Error Resume Next
Set objOutLook = GetObject(, "Outlook.application")

If Err.Number <> 0 Then
OlWasNotRunning = True
Set objOutLook = CreateObject(&quot;outlook.application&quot;)
Set objNameSpace = objOutLook.Application.GetNamespace(&quot;MAPI&quot;)
objNameSpace.Logon , , True, True
Err.Clear
Else
OlWasNotRunning = False
Set objNameSpace = objOutLook.Application.GetNamespace(&quot;MAPI&quot;)
End If

End Sub

this checks for existing instance of Outlook , if not available, shows the login dialog box (also asks for a profile to select), this will however not show the application.

hope this helps , lemme know ...

[cheers]
Niraj [noevil]
 
here is the code i used in one of my aplication:
I read every 3 minutes the unread messages of a mailbox and them i mask them as unread

Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
Dim objSess, objInbox, objMsgColl, objMsgFilter As Object
Dim objMess As Message

Private Sub Form_Load()
Me.Caption = &quot;incoming Alerts utility&quot;
Set objSess = CreateObject(&quot;MAPI.Session&quot;)
'logon to session
objSess.Logon profileName:=&quot;****&quot;, _
profilePassword:=&quot;*****&quot;, _
showDialog:=True, _
ProfileInfo:=&quot;EXcangeName&quot; & vbLf & &quot;Mailbox&quot;

Set objInbox = objSess.Inbox
Set objMsgColl = objInbox.Messages ' get Inbox's messages collection

End Sub


Private Sub new_alerts()

Dim str As String
Dim str_line As String
Dim k As Long

Dim b As String

'filters
Set objMsgFilter = objMsgColl.Filter
objMsgFilter.TimeLast = DateValue(&quot;02/17/09&quot;)
objMsgFilter.Unread = True

For Each objMess In objMsgColl

HERE put your code .I used string manipulatiion and trasfered all my data in SQL.Read the subject and put maybe some If statements. To send mail the code is similar and is in the Forums FAQ.

'mask As read
objMess.Unread = False
objMess.Update

update_rst


Next


End Sub


Private Sub Timer1_Timer()

Static Minutes As Long

Me.Enabled = False
Minutes = (Minutes + 1) Mod 3
If Minutes = 0 Then
new_alerts
End If
Me.Enabled = True

End Sub
then i simply send a reply mail
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top