LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sendmail (https://www.linuxquestions.org/questions/linux-newbie-8/sendmail-599219/)

Sherlock 11-13-2007 12:12 AM

Sendmail
 
Hi

I need to send a mail from a java program using the sendmail program..

But i a m not getting it right...and there is no man available in the machine...Its a linux machine..

i typed the below at command prompt..

sendmail -bt -f Sherlock -v Sherlock@xyz.com and this was the result

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>


I killed it...


Also how to define the message and the subject in the mail...

yusufs 11-13-2007 01:32 AM

Quote:

Originally Posted by Sherlock (Post 2957086)
Hi

I need to send a mail from a java program using the sendmail program..

But i a m not getting it right...and there is no man available in the machine...Its a linux machine..

i typed the below at command prompt..

sendmail -bt -f Sherlock -v Sherlock@xyz.com and this was the result

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>


I killed it...


Also how to define the message and the subject in the mail...



Hai Sherlock,


add your mail server to the /etc/hosts like :


192.168.0.84 mailserver mailserver.domain.fulladdress


go to the vi /etc/mail/sendmail.cf

grep for the word DS

and change it like

DSmailserver

where mailserver is the alias name set in hosts file.

and try sending the mail now..

let me know if u have any errors.


Yusuf

Sherlock 11-13-2007 04:45 AM

Hi

I tried it the below way

sendmail Sherlock@xyz.com<Mail.txt

And the mail.txt contains

date : ...
To : x@y.com
Subject : ..
from : Z@G.com

body of the message

From command line....it is working fine...

But i am having problem executing it from the java program..



String cmd="/usr/sbin/sendmail xyz@SS.com <Mail.txt";

try {
Runtime.getRuntime().exec(cmd);
} catch (IOException ioe) {
System.out.println(" exception while sending the mails ");
ioe.printStackTrace();
}

Regards

Sherlock 11-13-2007 11:36 PM

Able to send the message but

How to send an attachment using sendmail

-a option doesnt exists in this version of linux...


All times are GMT -5. The time now is 03:48 PM.