Use of java mail to send email from UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Use of java mail to send email from UNIX
# 1  
Old 03-06-2017
Use of java mail to send email from UNIX

Can someone help me to understand how to configure java mail on unix or what is syntex for that to put in script so email can be sent.

earlier i was using 'send mail' to send email and not SMPT is stopped in unix machine and they asked us to use java mail.
Before I was using this
Code:
FROM="servername"
(
 echo "From: $FROM"
 echo "To: $MAILTO"
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"'
 echo
 echo '---q1w2e3r4t5'
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 echo
 cat $BODY
 echo
 echo '---q1w2e3r4t5'
 echo 'Content-Type: application; name="'${ATTACH_NAME1}'"'
 echo "Content-Transfer-Encoding: uuencode"
 echo 'Content-Disposition: attachment; filename="'${ATTACH_NAME1}'"'
 echo
 uuencode $ATTACH1 $ATTACH1
 echo
 echo '---q1w2e3r4t5--'
) | /usr/sbin/sendmail $MAILTO $CC

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to send email if Java process was done

Hi Team, I need script to send notification if java process was down. Can you please help on this. Thanks in adance. Regards, Nagesh (1 Reply)
Discussion started by: Nageswara Reddy
1 Replies

2. Programming

Unable to send email using Java in Linux

Hi All, We recently moved to Red Hat Enterprise Linux Server release 6.6 from Solaris 10. The existing Java code to send emails in Solaris is public class card_cardMessenger{ /** * Send an e-mail message via the Runtime class * @see Runtime * @return boolean (success or failure of... (1 Reply)
Discussion started by: Meghan2525
1 Replies

3. Red Hat

Send email using mail

I need to send an email from linux using mail command. The problem is I can't hardcode the to: emailaddress, The email address is saved in a recipient.lst file on the server in this format: To: a@b.com Thanks a lot. il_labor (1 Reply)
Discussion started by: il_labor
1 Replies

4. Linux

Send email using mail

I need to send an email from linux using mail command. The problem is I can't hardcode the to: emailaddress, The email address is saved in a recipient.lst file on the server in this format: To: a@b.com Thanks a lot. il_labor (1 Reply)
Discussion started by: il_labor
1 Replies

5. Shell Programming and Scripting

Script to Send an email using mail command

Hello all I'm trying to write a script to send an email, so I can be nnotified when something is going wrong with my system. I've tried many options with no luck: mail -s "You've got mail" somebody@example.com echo "Mail Body" | mail -s "Subject" somebody@example.com I tried also to... (1 Reply)
Discussion started by: samer.odeh
1 Replies

6. UNIX for Dummies Questions & Answers

Configuring mail to send email from server to client

Hi, I want to send an email from server to my gmail account for all critical messages reported in the server. Kindly help me in configuring the same. Regards Rochit (1 Reply)
Discussion started by: rochitsharma
1 Replies

7. Programming

Not able to send a mail using JAVA code

Hi All, I am trying to send a mail from Solaris 5.9 using JAVA code.but when I am trying to do the same.then I am not able to read a line(data) from buffer..I am only able to connect to SMTP server but not able to get the data from buffer. when I am trying to read the line -- it is no able... (0 Replies)
Discussion started by: smartgupta
0 Replies

8. UNIX for Dummies Questions & Answers

how to send mail from server to client's email-id

i want to send email from server to the client's email-id. server is solaris. please help me out.i want to send mail to the email-id not to the var/spool/mail. (8 Replies)
Discussion started by: parmeet
8 Replies

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

10. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies
Login or Register to Ask a Question
pygm2n(1)						    Python Gateway mail to news 						 pygm2n(1)

NAME
pygm2n - Python Gateway mail to news SYNOPSIS
pygm2n -n newsgroups [ -s newsserver ] [ -h ] DESCRIPTION
IMPORTANT: this man page is to be continued. The Whole pyg gateway is in devel. state. try -h option for more detailed option. pygm2n reads from stdin an email, sending it to newsgroups, a comma separated list without spaces of newsgroup names (at least one), rfc799 compliant. If pygm2n reads from stdin a sigle line starting with /, it is considered an absolute path to a single-email mailbox, so pygm2n will open and read it. Note that now pyg can't read a real mailbox, with many emails. If you give it in input, pyg will post the whole mailbox as a single email. EXAMPLES
There is some documetation in /urs/share/doc/pyg I created mailgate user (moderator of local.moderated ng). Subscribe to a list with this user (or simply email one message to). Every email posted to this user will send to newsgroups, in its .procmailrc I've put something like: :0 bh * ^From *mailinglist-request@lists.debian.org | $HOME/pygm2n -n local.debian.mailinglist AUTHORS
Cosimo Alfarano <alfarano@students.cs.unibo.it> BUGS
Boh. send any bug, advice or opinion to the author, please. Sun Sep 12 18:10:00 CEST 2000 pygm2n(1)