I built a shell script sending mail by curl.
It works from command line as expected.

#include <Process.h>

void setup() 
  Bridge.begin();   	// Initialize the Bridge
  Serial.begin(9600);   // Initialize the Serial

  // Wait until a Serial Monitor is connected.
  Serial.println("Sending Mail..."); 

  Process p;        // Create a process and call it "p"
  while (p.available()>0) 
    char c =;

void loop()
  // nothing to do

In the monitor I can see the both serial outputs from the sketch and two echos from my shell script.
An email I receive only when I run the shell script but not the sketch.

sendmail.png (237 Bytes)

Can you also post the sendmail script? At first glance, your sketch looks right to me

I added the script as an attachment. (237 Bytes)

I guess the problem is with that --upload-file mail.txt. Try using an absolute path

Using an absolute path works. Thanks for your support.