-1

How can I send a zip file (~600MB) to an email account? What is the command line should be used in bash?

What if I want to FTP the files to a server automatically?

AStopher
  • 4,207
  • 11
  • 50
  • 75

3 Answers3

2

Well, in my opinion 600Mb is too large for e-mail, since some clients and servers will choke on that size. But that's your choice, and if you own the webserver then obviously you can do what you like.

The unix command mail can be used (when configured) to send emails.

You might also want to look at perl's Net::SMTP module, which is for this sort of thing.

Alex Brown
  • 41,819
  • 10
  • 94
  • 108
2

Most linux distributions contain a mail command (from the mailx package). You can attach a file from the command line using the -a option:

mail -s 'file attached' -a /path/to/file someone@example.com

That said, most mail systems won't be happy with 600MB attachments.

The ncftp package has a number of commands that may be useful for automated transferring of files over FTP, in particular the ncftpput command (see the manpages for more information).

Depending on where you are sending the file, if the other end supports ssh, it might be better to use tools like scp or ssh and rsync. With public key authentication, you don't even have to worry about embedding a password anywhere.

If you are doing backups, consider a tool like Duplicity (but not for a full zip file as it loses most of its advantages) as it supports a number of protocols, performs compression on-the-fly and can perform incremental backups. Oh, and the backups are encrypted and digitally signed to ensure their integrity.

Adam Batkin
  • 51,711
  • 9
  • 123
  • 115
  • -a Specify additional header fields on the command line such as "X-Loop: foo@bar" etc. You have to use quotes if the string contains spaces. This argument may be specified more than once, the headers will then be concatenated. – jmoz Nov 23 '12 at 17:15
  • @jmoz - Not on my box. `man mail` says: `-a file Attach the given file to the message`. http://linux.die.net/man/1/mail agrees – Adam Batkin Nov 23 '12 at 21:06
1

You can split it up with "split" first, send it with "mail" then concatenate it at the other end with "cat".

Paul Bullough
  • 141
  • 1
  • 6