send email to email id which is having # symbol


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting send email to email id which is having # symbol
# 1  
Old 08-29-2011
send email to email id which is having # symbol

Hi,

I have one requirement to send email to email id which is having # ( in the begining of the email id).

I'm using mailx command to send an email. But not receiving those emails, but email status is showing email sent successful.

Code which i'm using is :

Code:
cat  file1.txt | mailx -s 'Testing mail with # in begining without quotes' testing1@hostname,#testing2@hostname -- -f no-reply@motorola.com

If I enter email address within single quotes or double quotes also, not working properly, says email sent successfully.

one more example,

Even If I place # email id as first email id, will throw below error,
You must specify direct recipients with -s, -c, or -b.

After that, I have enter email address within single quotes or double quotes also, i'm not receiving the email. but its says email sent successfully.

Can you please help me to resolve this issue?
Because I got the requirement which email id has the # symbol.

Regards
Latika
# 2  
Old 08-29-2011
try assign the email id's to a variable and then use that variable in the mailx syntax ..
# 3  
Old 08-29-2011
Quote:
Originally Posted by jayan_jay
try assign the email id's to a variable and then use that variable in the mailx syntax ..

Hi Jayan,

I'm using below code to send an email, getting status as email sent successfully, but not reciving the email in inbox.

Code:
$cmd="cat file1.txt";
$emailsubject ="Testing script mail # in begining with dobule quotes";
$emailaddress="#name\@hostname,name2\@hostname,name3\@hostname";
$from_address="no-reply\@hostname";
# double quotes
$cmd = $cmd . "|" ."mailx -s '$emailsubject' \"$emailaddress\" -- -f $from_address" ;
# single quotes
#$cmd = $cmd . "|" ."mailx -s '$emailsubject' \'$emailaddress\' -- -f $from_address" ;
print "Command is : $cmd\n";
if(system($cmd)){
        print "Email sent Failed\n";
}else {
        print "Email sent successfuly\n";
}

# 4  
Old 08-29-2011
Code:
 
#!/usr/bin/perl
use MIME::Lite;
$msg = MIME::Lite->new(
        From     => 'Sender Name <sender@abc.com>',
        To       => 'recipient@abc.com,#two@abc.com',
        Subject  => 'Accepted!',
        Data     => "Hi This is the Test Message!"
);
$msg->send;

Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies

2. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

3. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

4. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

5. Shell Programming and Scripting

cant send email

Hi I run this script. See below sqlplus "/as sysdba" @tb.sql > /ek_ora/script/tb.log mailx -r oraadm@juwpkl.gov.my -c "adzuan@nc.com.my"\ -s "TABLESPACE ALERT" adzuan@nc.com.my i < /ek_ora/script/tb.log in linux, i can send mail and got the email body content after tb.sql is spool to... (1 Reply)
Discussion started by: adzuanamir
1 Replies

6. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

7. 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
Login or Register to Ask a Question