Jump to content


  • Posts

  • Joined

  • Last visited

mattarndt's Achievements


Newbie (1/14)



  1. Quote: Does this mean that we can't receive e-mails on Mac OS X? If you want to use the Python event handler and struggle with SMTP/AUTH at your provider's mail server, have a look at http://forums.dantz.com/ubbthreads/showflat.php?Number=86249 HTH, Mattes
  2. As I was asked in an usenet thread for more details, I decided to post a more detailed description. Maybe some future questions will be answered this way... 1.) First I wrote a PHP script to send emails with SMTP-AUTH and let it accept the same positional parameters as the original "macmail.py". I called it "macmail.php" and as I am not able to attach it to this posting, here is the complete script quoted: Code: <?php $to = $_SERVER['argv'][1]; $smtpServer = $_SERVER['argv'][2]; $subject = $_SERVER['argv'][3]; $bodyfile = $_SERVER['argv'][4]; $from = $_SERVER['argv'][5]; $username = $_SERVER['argv'][6]; $password = $_SERVER['argv'][7]; $port = "25"; $timeout = "30"; $localhost = "localhost"; $newLine = "\r\n"; $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout); $smtpResponse = fgets($smtpConnect, 515); if(empty($smtpConnect)) { $output = "Failed to connect: $smtpResponse"; return $output; } fputs($smtpConnect, "HELO $localhost" . $newLine); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect,"AUTH LOGIN" . $newLine); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect, base64_encode($username) . $newLine); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect, base64_encode($password) . $newLine); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect, "MAIL FROM: $from" . $newLine); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect, "RCPT TO: $to" . $newLine); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect, "DATA" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $headers = "MIME-Version: 1.0" . $newLine; $headers .= "Content-type: text/plain" . $newLine; $headers .= "To: Administrator <$to>" . $newLine; $headers .= "From: Retrospect Backup <$from>" . $newLine; $headers .= "Subject: $subject" . $newLine; $message = file_get_contents($bodyfile); fputs($smtpConnect, "$headers\r\n\r\n$message\r\n.\r\n"); $smtpResponse = fgets($smtpConnect, 515); fputs($smtpConnect,"QUIT" . $newLine); $smtpResponse = fgets($smtpConnect, 515); ?> Make sure to remember the location of this script as you will need it in step 3. 2.) After that I copied the Python event handler into Retrospect's preference folder and changed its attribute to make it executable ("chmod ugo+x ..."). 3.) Then I modified the following lines of the event handler: Of course the standard properties to define kMainGroup, kMailServer, kFrom, kUsername, kPassword, but also kScriptCommand (to "/usr/bin/php /.../macmail.php", this must point to the PHP script of step 1). Additional I changed the mail subjects used in the "scriptEnd" paragraph to include the script name into the email subjects (two times: <set mySubject to theScript & ": Execution completed successfully!> and <set mySubject to theScript & ": Retrospect script finished with errors">). In other paragraphs I mount and unmount my backup device, but this is of course not related to the topic of this thread. VoilĂ  ... HTH, Mattes
  3. Guys, unfortunately you don't write how you access the NAS, but because of you mentioning "... Retrospect reports an error and then unmounts the Ethernet disk share ..." I assume, you're using Restrospect to mount the shares. I never got a SMB share working within Retrospect and AFP is too limited with my NAS (Synology DS-106j). I mount the (SMB-) share using the event handler script when starting Retrospect and unmount it while existing and it works like a charm. At least for backing up 16 GB of local user data... HTH, Matthias
  4. Hi! Some days ago I tried to enable the Retrospect event handler to email me some status reports. To avoid dependancies with the mail client I chose the Python script. Unfortunately (well, actually fortunately) my ISP requires SMTP-AUTH, so I changed the Apple script file accordingly, but no mail was sent. While debugging I copied the Python file, stripped down its code to the bare SMTP functions. It seemed that the smtplib.SMTP call received an error ("No address associated with nodename"), although I was able to access the smtp server (by host name or IP address) with ping, telnet, ... I finally gave up and wrote a PHP script, which accepts the same positional parameters as "macmail.py" and handles the SMTP conversation including the authentication. After changing the corresponding shell statement in the Apple script file, everything works like a charm. Is anybody (!) able to send SMTP-AUTH mails via the Python event handler? I just wonder what went wrong (Mac OS X 10.4.7, Retrospect Desktop 6.1.126) ... Bye, Mattes
  • Create New...