Sign in to follow this  
Followers 0
LaurentiuB

send file

8 posts in this topic

How can I attach a file (the name file can be diferent, but i know the extension) to an e-mail message and send it?

More, it's posible to run the script without user intervention ?

I know how to create an e-mail but I don't know how to attach a file.

Share this post


Link to post
Share on other sites



Have a look at those blat-udfs at scripts@scraps.

There should be some if you just use the search button and type blat. :P

Share this post


Link to post
Share on other sites

Hi, I did the same for sending every morning a Mail.

I used Outlook Express (no need for an additional Office License).

It' s configured as a client.

if FileExists("S:\sicher\sicher.zip") Then
; Run Outlook
Run("C:\Programme\Outlook Express\MSIMN.EXE")
; Wait for the Outlook become active
WinWaitActive("Outlook Express")
; Now that the Outlook window is active type some text
Sleep(500)
Send("!d")
; new message
send("n")
send("e")
Sleep(500)
winwaitActive("Neue Nachricht"); English: winwaitActive("New message")
; Enter Mail adress
send("xxx@xfdsjgk.com")
sleep(500)
send("+{Tab 2}")
sleep(500)
; Subject
send("Files")
sleep(500)
send("+{Tab 3}")
sleep(500)
; a short text
send("The daily files")
sleep(500)
; Attach files
send("!i")
send("a")
sleep(500)
send("s:\sicher\sicher.zip"); insert here the path to your file - If more then one file use semicolon to add next file
sleep(500)
send("!e")
sleep(500)
; Now send the Mail
Send("!s")
; Quit Outlook Express
sleep(500)
send("!d")
send("b")

Hope it helps.

I know it's not perfect, but it works great. If someone has a shorter Version of it, just message me.

CU @ ALL

-[-Gun-Food-]-

Share this post


Link to post
Share on other sites

It would be much better to use blat, since there is no interaction, that can be interrupted.

As far as I figured out, outlook (and maybe outlook express) is such a bunch of cusomized bars & menus, that save Controlsend will fail. As you use Send, your script will be interrupted by a simple popup (Maybe sth. like "Update Adobe Reader", "Virus found" ...). If this data that should be send is sensitive, use blat. It's very small, open source and you neither need outlook express. :P

Share this post


Link to post
Share on other sites

It would be much better to use blat, since there is no interaction, that can be interrupted.

As far as I figured out, outlook (and maybe outlook express) is such a bunch of cusomized bars & menus, that save Controlsend will fail. As you use Send, your script will be interrupted by a simple popup (Maybe sth. like "Update Adobe Reader", "Virus found" ...). If this data that should be send is sensitive, use blat. It's very small, open source and you neither need outlook express. :P

if you're using outlook, personally i believe the solution should be outlook based whenever possible. i would suggest using COM via AutoIT, or VBA. I will type up a VBA script real quick and append it to this message, it shouldn't take much to modify it to an AutoIT script utilizing COM interaction...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

if you're using outlook, personally i believe the solution should be outlook based whenever possible. i would suggest using COM via AutoIT, or VBA. I will type up a VBA script real quick and append it to this message, it shouldn't take much to modify it to an AutoIT script utilizing COM interaction...

here ya go. this is entered into the VBA IDE accessed by pressing alt + f11 in outlook.

Public Sub blah()
Set mymessage = Application.CreateItem(olMailItem)
mymessage.Recipients.Add "me@myprovider.com"
mymessage.Attachments.Add "c:\test.txt"
mymessage.Subject = "Subject goes here"
mymessage.Body = "vba is neat."
mymessage.Display
mymessage.Send

End Sub

you could even omit the 'mymessage.display' line, and the message would not even be displayed prior to sending.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I don't know how to code vba (and I think autoit 3.1.1 was not able to do so natively), but seems like it's not that hard...

Where should I look for outlook-vba-code? :lmao:

Example: I would love to start the import-dialog without using Send - at least I did't find any good way. Although I have to add that those functions suck since outlook wasn't able to export and reimport properly if you use excel or access-format ... :(:P

Edited by dabus

Share this post


Link to post
Share on other sites

I don't know how to code vba (and I think autoit 3.1.1 was not able to do so natively), but seems like it's not that hard...

Where should I look for outlook-vba-code? :lmao:

Example: I would love to start the import-dialog without using Send - at least I did't find any good way. Although I have to add that those functions suck since outlook wasn't able to export and reimport properly if you use excel or access-format ... :(:P

i have a few sites in my list at home i can post when i get off, i had a hard time finding resources when i was trying to learn the syntax etc for doing things in outlook, but i was able to find a few references. Also in teh vba interface, if you press F2 you can check out the objects and methods available, that may help. In the interim though, i may be able to help you do the things you want to do with outlook, and there are a few outlook interaction scripts in the scripts and scraps forum that may accomplish what you're trying to do. As far as the import you're talking about, if you give me some more details, as to how you do it manually, and what exactly it is you're trying to do, i may be able to whip something up for you.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0