how to send email using "mail" to google or yahoo | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

how to send email using "mail" to google or yahoo

UNIX for Advanced & Expert Users


Tags
email, google, mail, smtp

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-25-2010
coolatt's Avatar
coolatt coolatt is offline
Registered User
 
Join Date: Mar 2009
Last Activity: 21 October 2014, 5:12 AM EDT
Location: Mauritius
Posts: 93
Thanks: 13
Thanked 2 Times in 2 Posts
how to send email using "mail" to google or yahoo

hi all,

i need to email the output of a command to a google or yahoo account.
am using debian lenny 5.
can someone please help me on this ?
Sponsored Links
    #2  
Old 06-25-2010
a_programmer a_programmer is offline
Registered User
 
Join Date: Jun 2010
Last Activity: 1 March 2012, 1:49 PM EST
Posts: 55
Thanks: 3
Thanked 11 Times in 11 Posts
you can use the regular mailx command to do that:



Code:
echo "test message" | mailx -s "Test subject" xyz@gmail.com

In some corporate systems, the unix smtp server is configured to not allow emails outside the company domain. Adding a return email address using the -r flag usually fixes that:



Code:
echo "test message" | mailx -r you@yourcompany.com -s "Test subject" xyz@gmail.com

Sponsored Links
    #3  
Old 06-25-2010
dr.house dr.house is offline
Registered User
 
Join Date: Dec 2008
Last Activity: 30 October 2011, 12:05 PM EDT
Location: Switzerland
Posts: 454
Thanks: 4
Thanked 27 Times in 27 Posts
What I used on Debian 5 (with HushMail, though): sendemail
    #4  
Old 06-25-2010
coolatt's Avatar
coolatt coolatt is offline
Registered User
 
Join Date: Mar 2009
Last Activity: 21 October 2014, 5:12 AM EDT
Location: Mauritius
Posts: 93
Thanks: 13
Thanked 2 Times in 2 Posts
Quote:
Originally Posted by a_programmer View Post
you can use the regular mailx command to do that:



Code:
echo "test message" | mailx -s "Test subject" xyz@gmail.com

In some corporate systems, the unix smtp server is configured to not allow emails outside the company domain. Adding a return email address using the -r flag usually fixes that:



Code:
echo "test message" | mailx -r you@yourcompany.com -s "Test subject" xyz@gmail.com

thanks.
works great without the -r option.
i can send to gmail.

now,how do i send to an internal mail server that uses ssl for smtp ??
Sponsored Links
    #5  
Old 06-25-2010
a_programmer a_programmer is offline
Registered User
 
Join Date: Jun 2010
Last Activity: 1 March 2012, 1:49 PM EST
Posts: 55
Thanks: 3
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by coolatt View Post
thanks.
works great without the -r option.
i can send to gmail.

now,how do i send to an internal mail server that uses ssl for smtp ??
Do you mean you do not want to use your local unix server's configured smtp to send mail?
In my understanding, you only have to worry about SSL if the server that you are using to send an email requires SSL. You don't have to worry about what the target server uses.

I think if you need more control over what SMTP to use to send an email, you can use the sendmail utility.
Sponsored Links
    #6  
Old 06-28-2010
coolatt's Avatar
coolatt coolatt is offline
Registered User
 
Join Date: Mar 2009
Last Activity: 21 October 2014, 5:12 AM EDT
Location: Mauritius
Posts: 93
Thanks: 13
Thanked 2 Times in 2 Posts
Quote:
Originally Posted by a_programmer View Post
Do you mean you do not want to use your local unix server's configured smtp to send mail?
In my understanding, you only have to worry about SSL if the server that you are using to send an email requires SSL. You don't have to worry about what the target server uses.

I think if you need more control over what SMTP to use to send an email, you can use the sendmail utility.
yes.. i want to specify an smtp to use.
ok. it means i have to use sendmail. thanks.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
"Unable to send a mail" vinayakatj56 UNIX and Linux Applications 2 05-20-2009 08:37 AM
How to use "mail" to attach a file with an email? meili100 UNIX for Dummies Questions & Answers 2 02-23-2008 03:49 AM
can not send mail from unix server to company/yahoo mail b5fnpct UNIX for Dummies Questions & Answers 5 11-22-2002 09:24 PM



All times are GMT -4. The time now is 11:03 AM.