![]() |
Can the shell version of mail send an image?
Can the shell version of mail send an image as an attachment?
|
Sure can. Investigate uuencode and RFC 5322. Start with the Wikipedia article MIME (Not Mime - that gets you the Marcel Marceau variety).
|
Something like this should do the trick:
Code:
uuencode mypic.jpg mypic.jpg | mail someone@example.com |
Thank you; I'm almost there. I'm basically looking for a way to send a picture from my laptop camera without invoking Mail, i.e. in the background. I'll read the man pages for mail to see how to get smtp address and password into it.
|
iAlertU does this exact function. It snaps a pic and then emails it to the designated email address if the computer is disturbed while active. I, off the top of my head, have no idea how to code this. However, perhaps if you take apart the package with something like Pacifist you can see how they do it. It is an open source app.
|
Yes, I tried it, but it doesn't want to send an email via a webmail account - it wants smtp. If my laptop is nicked, I'm on the road and the only way I can check without it will be at a public terminal.
|
Quote:
|
Follow-up to last post:
I was wrong; I just wasn't configuring it properly.
To configure gmail, the mail server is smtp.gmail.com, the port is 465, you check "Use SSL Authentication", the mail server username is the entire account name: user@gmail.com, and you type in the password for your account. If you check the "Email Image" box, it sends the iSight image to the account. Takes about 15 seconds to do it. |
Quote:
On the other hand Gmail (web mail) does display both the correct file name and the embedded image. |
Quote:
Code:
uuencode pathToMyPic/mypic.jpg mypic.jpg | mail myAccount@gmail.com |
Did you check the mail queue immediately after executing the command?
Anything in /private/var/log/mail.log? Code:
Jun 22 08:15:24 Bleach postfix/local[10673]: 340AA31265B3: to=<xxxxx@mgnewman.com>, orig_to=<xxxxx@me.com>, relay=local, delay=0.15, delays=0.09/0.05/0/0.01, dsn=2.0.0, status=sent (forwarded as 4E19631265B4) |
Yes: Here's the key line:
Quote:
|
Did you setup postfix by editing:
/private/etc/postfix/main.cf |
Ahh.... no. Nor will I be able to do so with any understanding (I did look), but thanks for pointing it out.
|
Quote:
|
Thanks, tw;
Unfortunately, I don't use Mail.app on my Laptop -- it's a long story -- and I want to send the image from there to a gmail account entirely in the background. Marcel's MIME type was audio/silence, I believe, although it might have been audio/gestures. |
Quote:
For me it was worth the trouble so that I could write some simple scripts to notify me of stuff via e-mail. For example, with Carbon Copy Cloner I have a postflight script that sends me e-mail when a backup operation is complete. If I don't get that e-mail I know that something's gone awry. Simple, but useful stuff. |
Here's an understandable Postfix tutorial: Postfix Basic Configuration
I think you could probably get away with changing just one or two entries in main.cf: myhostname: must be a real, resolvable domain name. I own mgnewman.com, so that's what I use here. relayhost: my ISP won't relay e-mail so I set this to the ISP's SMTP server. |
Thanks for all of that. I do have a .ca domain name and a dynDNS.org pointer to my IP address (dynamic but only changing when my cable ISP rebalances loadings). I intend to send this to smtp.gmail.com:465, with SSL Authentication and a password rather than to my cable ISP, so I'll have to read the docs at the link you've provided.
|
The destination of the e-mail doesn't affect how you setup Postfix. You just need to put enough information in the configuration file so that the servers along the way who relay and ultimately receive the e-mail will "know" that it's genuine and not from a spam-bot.
Here's what the headers look like for mail sent from the command line on my Mac to my Dot Mac account: Quote:
(The actual e-mail addresses shown above are fake.) |
Thanks, MN
|
| All times are GMT -5. The time now is 10:39 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.