Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sendmail/mailex/mail query

Status
Not open for further replies.

HHG

Technical User
Nov 8, 2003
68
GB
I have used the mailx command to send mail to users within our organisation. It looks like mailx can not be used to send mail to receipients outside of our organisation. Does any one know a way of sending mail to an external email.

mail from {sun email}
mail to {external email outside of the organisation}
subject: whatever
body of mail : aaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccccccccccccc

Something like this. Any help will be most appreicated.

Thanks
 
Many mail servers block email if the from address is not a valid domain
e.g. unixid@unixhost.yourcompany.com

Change your from address to e.g.
unixid.unixhost@yourcompany.com
 
HI Pdreyer.

So is the unixid(username on unix)what would be this syntax as I have only used mailx and the syntax is the same as your suggestion I think.

e.g. echo "body contents" | mailx -s "Subject" .email addresses to send.

The emails are send via a script in the user crontab. so the from address is unixusername@hostname.mycompanyname.org.uk

It may be that its blocked like you said at their end. I will check that but if you have any other suggestions please let me know.

Thanks for your help.

 
Ho there,

check out the following. I'm not sure whether this is going to work with all versions of sendmail or not, but it can't hurt to try:

--------------------------------------------------
Problem
How do I masquerade sendmail? I need to masquerade my email address. So instead of my email coming from user@hostname.domain.com, it will come from user@domain.com.


Solution
Make the following changes to the file /etc/sendmail.cf:

vi /etc/sendmail.cf
Search for DM
DM<domain.com> -->add your domain here.


Search for S94

Below S94, comment out the following line if it exists:
#R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
And, add the following line if it does not exist:
R$+ $@ $>93 $1
Save the file and enter the following command:
refresh -s sendmail
To test this, log in as another user instead of root, because root will not masquerade by default. Then, send a test message as follows:

mail -v user@domain.com

Subject:test <enter>

testing <enter>

. <enter>

CC: <enter>
Now the message should be from user@domain.com instead of user@hostname.domain.com.
--------------------------------------------------

Regards
Thomas
 
use -r
e.g.
echo "body contents" | mailx -s "Subject" -r "unixusername.hostname@mycompanyname.org.uk" pdreyer@somehost.com

or

-r "`/usr/xpg4/bin/id -un`.`uname -n`@mycompanyname.org.uk"

or if you want to receive the email if they reply

-r "your_personnal_company_email_address"
 
Hi Thanks for this I have tried the -r option. I think there is some setup we need to do on our sun box to allow emails to be sent externally not sure what that is yet.
 
What may be the easiest answer (as long as you don't need a reply) is to use a relay. My linux servers don't know how to send mail outside the organisation, but they know a server (the main Exchange server) which does.

To implement this edit /etc/mail/sendmail.cf and look for the DS section . Mine looks like
Code:
# "Smart" relay host (may be null)
DSmyexchangeserver.mycorp.net
Restart the sendmail daemon afterwards.

This tells sendmail to send any mail it doesn't know how to handle to myexchangeserver.mycorp.net to sort it out. As I said, this works fine as long as you don't need a reply.

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top