Sponsored Content
Full Discussion: modifying perl script
Top Forums Shell Programming and Scripting modifying perl script Post 302331391 by reaky on Monday 6th of July 2009 04:33:26 AM
Old 07-06-2009
I think I know the problem now but I don't know how to solve it
the problem that the sendmail command still using root@localhost.localdomain when sending, Which is rejected
Look to the delevery failier:
==========================
The original message was received at Mon, 6 Jul 2009 11:16:03 +0300
from blackreaper [127.0.0.1]

----- The following addresses had permanent fatal errors -----
<reaky@domain.com>
(reason: 554 mailfrom without country or top level domain is administratively denied)

----- Transcript of session follows -----
... while talking to out.tedata.net.eg.:
>>> MAIL From:<root@localhost.localdomain>
<<< 554 mailfrom without country or top level domain is administratively denied
554 5.0.0 Service unavailable

[-- Attachment #2 --]
[-- Type: message/delivery-status, Encoding: 7bit, Size: 0.3K --]

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; blackreaper
Arrival-Date: Mon, 6 Jul 2009 11:16:03 +0300

Final-Recipient: RFC822; reaky@domain.comt
Action: failed
Status: 5.0.0
Diagnostic-Code: SMTP; 554 mailfrom without country or top level domain is administratively denied
Last-Attempt-Date: Mon, 6 Jul 2009 11:16:03 +0300

[-- Attachment #3 --]
[-- Type: message/rfc822, Encoding: 7bit, Size: 0.8K --]

Date: Mon, 6 Jul 2009 11:16:03 +0300
To: reaky@domain.com
From: reaky@domain.com
Subject: SME Log Alert: Jul 6 11:15:21 Central.mc.tedata.net/Central.mc.tedata.net sshd[7527]: pam_unix(sshd:session):
+session opened for user amrali by (uid=0)
====================
How to solve this ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl - Appending/Modifying Excel files

Hi I have been using Spreadsheet::ParseExcel and Spreadsheet::WriteExcel to read and write excel workbooks, respectively. Spreadsheet::WriteExcel can only be used for creating new excel spreadsheets. I am looking for a module that would/should help me in appending to existing excel files.... (2 Replies)
Discussion started by: srinivay
2 Replies

2. Shell Programming and Scripting

need help with understanding and modifying script

hi all, i am new to UNIX. this is my first time using Ubuntu. i need to do this for my fyp. i am using an artificial neural network model to predict the yield strength of steel. the shell script used to execute this model is as shown here: #Thomas Sourmail, Cambridge University /... (4 Replies)
Discussion started by: dakkorn
4 Replies

3. Shell Programming and Scripting

Help modifying script to loop through all folders

I have this script someone very kindly help me write last year which loops through all files in a folder and does a command. I need to modify it to loop through all sub-folders of a main folder and only perform the command on files modified after Jan 1st 2008. And I need the command to place the... (3 Replies)
Discussion started by: Fred Goldman
3 Replies

4. Shell Programming and Scripting

Modifying a .ksh script

Hi users, I am on a beginner level and just joined this site. I have created a simple .ksh file in the following manner cat <<EOF >mfile #!/bin/ksh echo "hello world" EOF Request for some help with 2 cases 1. now i would like to add a second line after the first echo command... (4 Replies)
Discussion started by: corbusier
4 Replies

5. Shell Programming and Scripting

modifying file using script

Hi, I am new to shell programming, and want to know is it possible to change the contents of file using script? for example, if want to search 2 words and want to replace these words with 2 new words. Regards, Manoj (4 Replies)
Discussion started by: manoj.solaris
4 Replies

6. Shell Programming and Scripting

Modifying the Restart Script

Hello, I have a shell script which calls for an existing script with appropriate parameters. It looks something like this. -------------------------------------------------------------------------- #!/bin/bash sh /root/ams_rc stop_shepherd > /dev/null sleep 30 sh /root/ams_rc... (9 Replies)
Discussion started by: Siddheshk
9 Replies

7. Shell Programming and Scripting

Help in modifying existing Perl Script to produce report of dupes

Hello, I have a large amount of data with the following structure: Word=Transliterated word I have written a Perl Script (reproduced below) which goes through the full file and identifies all dupes on the right hand side. It creates successfully a new file with two headers: Singletons and Dupes.... (5 Replies)
Discussion started by: gimley
5 Replies

8. Shell Programming and Scripting

Need some help modifying script

I have a script that currently runs fine and I need to add or || (or) condition to the if statement and I'm not sure the exact syntax as it relates to the use of brackets. my current script starts like this: errLog="/usr/local/website-logs/error.log" apacheRestart="service httpd restart"... (3 Replies)
Discussion started by: jjj0923
3 Replies

9. Shell Programming and Scripting

Modifying file from command line using Perl

Hi all, I am having a slight issue updating a file using perl from the command line I need some help with. The item is: DATA_FILE_TYPE=FULL When I run the below command /usr/bin/perl -p -i -e "s/DATA_FILE_TYPE=/DATA_FILE_TYPE=APPEND/g" processfile.cfg It looks to be... (2 Replies)
Discussion started by: kstevens67
2 Replies

10. Shell Programming and Scripting

Help in modifying a PERL script to sort Singletons and Duplicates

I have a large database which has the following structure a=b where a is one language and b is the other and = is the delimiter Since the data treats of language, homographs occur i.e. the same word on the left hand side can map in two different entries to two different glosses on the right... (3 Replies)
Discussion started by: gimley
3 Replies
MAIL(3) 								 1								   MAIL(3)

mail - Send mail

SYNOPSIS
bool mail (string $to, string $subject, string $message, [string $additional_headers], [string $additional_parameters]) DESCRIPTION
Sends an email. PARAMETERS
o $to - Receiver, or receivers of the mail. The formatting of this string must comply with RFC 2822. Some examples are: ouser@example.com ouser@example.com, anotheruser@example.com oUser <user@example.com> oUser <user@example.com>, Another User <anotheruser@example.com> o $subject - Subject of the email to be sent. Caution Subject must satisfy RFC 2047. o $message - Message to be sent. Each line should be separated with a CRLF ( ). Lines should not be larger than 70 characters. Caution (Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot. <?php $text = str_replace(" .", " ..", $text); ?> o $additional_headers (optional) - String to be inserted at the end of the email header. This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF ( ). If outside data are used to compose this header, the data should be sani- tized so that no unwanted headers could be injected. Note When sending mail, the mail must contain a From header. This can be set with the $additional_headers parameter, or a default can be set in php.ini. Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows. Note If messages are not received, try using a LF ( ) only. Some Unix mail transfer agents (most notably qmail) replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with RFC 2822. o $additional_parameters (optional) - The $additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting. For example, this can be used to set the enve- lope sender address when using sendmail with the -f sendmail option. This parameter is escaped by escapeshellcmd(3) internally to prevent command execution. escapeshellcmd(3) prevents command execution, but allows to add addtional parameters. For security rea- sons, it is recommended for the user to sanitize this parameter to avoid adding unwanted parameters to the shell command. Since escapeshellcmd(3) is applied automatically, some characters that are allowed as email addresses by internet RFCs cannot be used. mail(3) can not allow such characters, so in programs where the use of such characters is required, alternative means of sending emails (such as using a framework or a library) is recommended. The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users. RETURN VALUES
Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 4.2.3 | | | | | | | The $additional_parameters parameter is disabled | | | in safe_mode and the mail(3) function will expose | | | a warning message and return FALSE when used. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Sending mail. Using mail(3) to send a simple email: <?php // The message $message = "Line 1 Line 2 Line 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70, " "); // Send mail('caffeinated@example.com', 'My Subject', $message); ?> Example #2 Sending mail with extra headers. The addition of basic headers, telling the MUA the From and Reply-To addresses: <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . " " . 'Reply-To: webmaster@example.com' . " " . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Example #3 Sending mail with an additional command line parameter. The $additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path. <?php mail('nobody@example.com', 'the subject', 'the message', null, '-fwebmaster@example.com'); ?> Example #4 Sending HTML email It is also possible to send HTML email with mail(3). <?php // multiple recipients $to = 'aidan@example.com' . ', '; // note the comma $to .= 'wez@example.com'; // subject $subject = 'Birthday Reminders for August'; // message $message = ' <html> <head> <title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . " "; $headers .= 'Content-type: text/html; charset=iso-8859-1' . " "; // Additional headers $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . " "; $headers .= 'From: Birthday Reminder <birthday@example.com>' . " "; $headers .= 'Cc: birthdayarchive@example.com' . " "; $headers .= 'Bcc: birthdaycheck@example.com' . " "; // Mail it mail($to, $subject, $message, $headers); ?> Note If intending to send HTML or otherwise Complex mails, it is recommended to use the PEAR package PEAR::Mail_Mime. NOTES
Note The Windows implementation of mail(3) differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket (which can either on the localhost or a remote machine). Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP. As such, the $to parameter should not be an address in the form of "Something <someone@example.com>". The mail command may not parse this properly while talking with the MTA. Note It is worth noting that the mail(3) function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient. For the sending of large amounts of email, see the PEAR::Mail, and PEAR::Mail_Queue packages. Note The following RFCs may be useful: RFC 1896, RFC 2045, RFC 2046, RFC 2047, RFC 2048, RFC 2049, and RFC 2822. SEE ALSO
imap_mail(3), PEAR::Mail, PEAR::Mail_Mime. PHP Documentation Group MAIL(3)
All times are GMT -4. The time now is 02:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy