Jump to content

Autosend Emails with Attachment


Recommended Posts

Hi! I'm working on a script that will automatically send an email when a new file will save in a folder. But I have a problem to switch it in the background. I have this:

RunWait($pathtogetmail & "\getmail.exe -u username -pw password -s pop3.server.com -delete -xtract -port 110")

But this doesn't work

RunWait($pathtogetmail & "\getmail.exe -u username -pw password -s pop3.server.com -delete -xtract -port 110", @SW_HIDE)

Can somebody help me?

Link to comment
Share on other sites

Thank you, that works! :-)

But now I have another problem. Look at this code please:

Func Send1()
 $attachment = ""
 While 1
  $pdffile = FileFindNextFile($file)
  If @error then ExitLoop
    FileMove($source & '\' & $pdffile , $dest, 1)
  $attachment = $attachment & '"' & $pdffile & '", '
 WEnd
  $attachment = StringLeft($attachment, StringLen($attachment) -2)
 If $smtpmethod = 1 then
  RunWait('"' & $blat egal.fil -to' & $to & '-subject ' & $subject & ' -ss -body ' & $message & ' -server ' & $smtp & ' -serverpop3 ' & $pop & ' -f ' & $from & '-i ' & $smtpname & '-port ' & $smtpport & ' -portpop3 ' & $popport & ' -u ' & $login & ' -pw ' & $pwd & ' -attachment ' & '$attachment & '"')
 Else
    RunWait('"' & $blat egal.fil -to' & $to & '-subject ' & $subject & ' -ss -body ' & $message & ' -server ' & $smtp & ' -f ' & $from & '-i ' & $smtpname & '-port ' & $smtpport & ' -pu ' & $login & ' -ppw ' & $pwd & ' -attachment ' & '$attachment & '"')

The Error:

Line 73: (File ... .au3)

RunWait('" & $blat ^ ERROR...

Unknown function name.

Unknown function name.

Do you know why it not works?

Edited by Message
Link to comment
Share on other sites

You could try writing a php script to do this and have it upload the files, and then call the page from autoit. But this is a sloppy method, and you might want to wait for a better reply.

<{POST_SNAPBACK}>

Yes, I hope anyone can give me a "better" method to do this. Blat can do it, but I don't know how.
Link to comment
Share on other sites

RunWait('"' & $blat egal.fil -to' & $to & '-subject ' & $subject.

^^

EDIT ... its late here

1

RunWait('"' & $blat egal.fil -to' & $to & '-subject ' & $subject.

**should be

RunWait( $blat...

2.

depending on what $blat actually represents... maybe you need

Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE)

There are way too many variable combinations to know what is what in your "snipit" script above

good luck

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Thanks Valuater.

I only want to send an email automatically to only one emailadress with an attachment. The smtp Server needs a authorisation with my username + password. Maybe you have an Idea with fewer variables?

Link to comment
Share on other sites

Search the Scripts and Scraps forum for Blat. There is a UDF that (I dont remember who) someone made, that will do everything you require.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Search the Scripts and Scraps forum for Blat. There is a UDF that (I dont remember who) someone made, that will do everything you require.

JS

<{POST_SNAPBACK}>

I can't find the script u talk about, so I search for another program to aend files with attachment in the commandline and found bmail.

http://www.beyondlogic.org/solutions/cmdli...cmdlinemail.htm

But whats when the smtp server needs a authorization, I can't find a command for this in bmail. Do you know if its able to make an authorization?

Link to comment
Share on other sites

VBScript sends messages with attachments. I rewrote it a while back in AutoIt, however, last time I checked, it doesn't allow attachments. I'll play with it sometime this weekend...might be able to get a fix for it (*wink* jpm)

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

VBScript sends messages with attachments.  I rewrote it a while back in AutoIt, however, last time I checked, it doesn't allow attachments.  I'll play with it sometime this weekend...might be able to get a fix for it (*wink* jpm)

<{POST_SNAPBACK}>

Ok Thanks.

Can you tell me where's the error here? I need a Commandline like this " c:\munpack -f -q file.msg".

"file.msg" is a variable.

Here's my code:

RunWait('"' & $pathtodecode & '\munpack" "' & '-f' & '-q' & $source & '"',"",@SW_MAXIMIZE)

I always get an empty commandline screen.

Link to comment
Share on other sites

Ok Thanks.

Can you tell me where's the error here? I need a Commandline like this " c:\munpack -f -q file.msg".

"file.msg" is a variable.

Here's my code:

RunWait('"' & $pathtodecode & '\munpack" "' & '-f' & '-q' & $source & '"',"",@SW_MAXIMIZE)

I always get an empty commandline screen.

<{POST_SNAPBACK}>

Wake up plz :)
Link to comment
Share on other sites

I don't know what munpack is? Is it a realprogram or something that you want to be an AutoIt script or something?

Here is the VBS code

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.Sender = "me@my.com"
objMessage.To = "test@paulsadowski.com"
objMessage.TextBody = "This is some sample message text."
objMessage.AddAttachment "c:\temp\readme.txt"

'==Config==

objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.myserver.com"

'Server port (typically 25)
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End Config==


objMessage.Send

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

I don't know what munpack is? Is it a realprogram or something that you want to be an AutoIt script or something?

munpack is a little program to make mime attachments.

What can I do with the VBS Code? I think I need autoit code?

Link to comment
Share on other sites

The VBS code will do exactly what you want, the only thing that doesn't work right now in AutoIt is the AddAttachment line, but I haven't tested it on the latest beta version, so I'm not sure if that issue has been fixed yet.

You can use AutoIt to automate the VBScript...

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...