I don't use Outlook to send email.  I use a program called Aemail.  It is really easy to use.  After installing the dll just add a reference to it in your VB project and you're ready to go.  The email is sent directly to the smtp server.  You can also attach files to the emails.  Aemail is shareware so you can try it first to make sure you don't have any firewall or other issues.  Normally, a firewall doesn't affect outgoing traffic.  We bought 10 licenses last year for $110.00.  For $11.00 it is well worth it if you want to send emails from a VB program.

Below is sample VB code to send an email using Aemail.

Private Sub SendEmail()
    aeObject.Clear
    aeObject.HostName = "smtp-server.GenHosp.com"
    'You can use the IP address of the smtp server or the server name if you are running DNS
    aeObject.FromAddress = "[EMAIL PROTECTED]"
    If SEAup Then
        'Only send regular email - Script is running
        aeObject.Subject = Status
        aeObject.AddTo "[EMAIL PROTECTED]", ""
        aeObject.Body = TxtMsg & vbCrLf & Response & vbCrLf & "Tests Completed =" & Str(TestNum)
        aeObject.AddAttachment "c:\temp\mydocument.doc"
    Else
        'Send email and Page Cell Phone - Script crashed
        aeObject.Subject = Status
        aeObject.AddTo "[EMAIL PROTECTED]", ""
        aeObject.AddTo "[EMAIL PROTECTED]", ""
        aeObject.Body = TxtMsg
    End If
    aeObject.Send
    txtStatus.Text = Status & "  " & Format(Now, "hh:nn am/pm") & "  Err=" & aeObject.LastError
End Sub


If you have any other questions, give me a call.

Corinna Robertson wrote:
I have a script that will email files using outlook, problem is I have an outlook/exchange client and it appears I need to be logged in to get it to send email. If I am not logged in, even though I am passing the user name & password I am getting an error. Does anyone have any ideas as to what I need to do to send an email without logging in to exchange?
 
Thanks,
 
Corinna
 
Neil Carman
Director Technical Development
Manigault & Associates LLC

http://www.m-allc.com
Work: (805) 680-5601
Fax: (714) 968-5632

Reply via email to