Automated mail code with example 
Author Message
 Automated mail code with example

Sub sendMail()
    Dim Outl As Object
    Dim msg As Object

    Set Outl = CreateObject("outlook.application")
    Set msg = Outl.createitem(olMailItem)

    With msg
        .To = Data.Cells(2, 16)
        .Subject = "IV curv for cell " & Data.Cells(2, 17)
        .Body = "This is the IV curv for the cell" &
Data.Cells(2, 17) & strMsgMail
        .Attachments.Add "C:\exchange\cells\DAT\EXCEL\Resul
ts.xls"
        .send
    End With

    Outl.Quit
    Set Outl = Nothing
    Set msg = Nothing
End Sub

There should be no difference between manually and
automatically
created email items. Since it works when you add the
recipient
manually I would have to think your code adding the
recipient is not
set up correctly. How are you adding the recipient and are
you
resolving them? Post a short snippet of your code so
people can look
at it.

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox
Press
Co-author of "Programming Microsoft Outlook 2000",
Chapters 8-13,
Appendices, Sams


Quote:
> Hello there, I have a problem wich I think is caused by
> some mail servers implementing spam blocking. I use
> automation to send a mail (I create an outlook object in
> Excel and send the mail). Unfortunately the server won't
> let it go through. I think that there is some information
> that is written on the mail that let the server know this
> was entered automatically, not manually. If I create all
> the message automatically but don't send it, and then
> enter the email adress of the recipient manually, it goes
> through without any problem. I am actually trying to make
> an application that will have to send mail automatically.
> Is there any workaround for that problem? Thanks.
> J-R



Sat, 17 Jan 2004 22:52:58 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. URGENT! Automating Mail Merge via VBA Code

2. How can I designate sender in VBA for Outlook Mail (example code)

3. You Have Mail: example code?

4. Automate mail using crystal mail device

5. Sending an Outlook mail from my VBA-code doesn't close the mail windows

6. automating an e-mail with access and outlook

7. Automate Access E-mail

8. Automating Outlook to send e-mails, error with XP

9. automating e-mail of invoices

10. Automate E-mail of invoices

11. Automated Mail merge from access to word

12. Automating Word Mail merge from a password-protected Access database

 

 
Powered by phpBB® Forum Software