Getting error while sending mail via smtp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting error while sending mail via smtp
# 1  
Old 05-26-2010
Getting error while sending mail via smtp

Hi All,
I used before a simple routine code in tcl to send mail.

Code:
package require smtp
package require mime
package require Tcl

proc send_simple_message {recipient email_server subject body} {

    set token [mime::initialize -canonical text/plain \
    -string $body]
    mime::setheader $token Subject $subject
    smtp::sendmessage $token \
    -recipients $recipient -servers $email_server -header [list From "FROM"] -header [list To "TO"]
    mime::finalize $token
}

send_simple_message someone@somewhere.com ENBMAIL01 "This is the subject." "This is the message."


I get errors about key-message id

Code:
key message-id not in header
    while executing
"error "key $mixed not in header""
    ("default" arm line 5)
    invoked from within
"switch -- $key {
        "" {
            set result ""
            foreach lower $state(lowerL) mixed $state(mixedL) {
                lappend result..."
    (procedure "::mime::getheader" line 7)
    invoked from within
"::mime::getheader $part ${message-idL} "
    invoked from within
"smtp::sendmessage $token  -recipients $recipient -servers $email_server -header [list From "FROM"] -header [list To "TO"]"
    (procedure "send_simple_message" line 7)
    invoked from within
"send_simple_message someone@somewhere.com ENBMAIL01 "This is the subject." "This is the message.""
    (file "test_mail.tcl" line 17)


Can someone help please,
Regards,
ZivSmilie

Last edited by pludi; 05-26-2010 at 11:31 AM.. Reason: code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Configuring smtp settings and then sending the mail through shell script

I have make an menu in which first option is to start and second is to stop the services echo "Please enter the appropriate choice for doing the operations" echo " 1) STOP Services 2) START Services case $choice in 1) ... (1 Reply)
Discussion started by: punpun66
1 Replies

2. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

3. UNIX for Advanced & Expert Users

exim4 sending via multiple gmail smtp accounts

I need to send mail using different gmail smtp logins, depending on the from header. I can put the appropriate expression in dc_smarthost to generate the host, but I don't know how to specify the login id. The login id comes from passwd.client and is associated with the server name. According to... (1 Reply)
Discussion started by: Millwood
1 Replies

4. Shell Programming and Scripting

php code - Sending mail with external SMTP server

Here is the code: <?php //new function function loadini($path) { $fp = fopen($path, "r"); $fpcontents = fread($fp, filesize($path)); fclose($fp); return $fpcontents; } $to = "test@test.com"; $nameto = "notme"; $from = "test"; $namefrom = "Who From"; ... (0 Replies)
Discussion started by: galford
0 Replies

5. Shell Programming and Scripting

Sending Attachment using MIME::Lite and Net::SMTP

Hello, I'm a newbie perl scriptor and i'm trying to figure out why i can't send an email using MIME::Lite with Net::SMTP. I keep receiving the following error: SMTP MAIL command failed: 5.7.1 Helo invalid . at attach1.pl line 31 The error keeps coming from the very last line... (2 Replies)
Discussion started by: xmaverick
2 Replies

6. UNIX for Dummies Questions & Answers

sending mail via smtp

Hi Gururs, I have a process on a middelware (SAP XI) that is runnung on HP-UX. This Process is creating a flatfile. Now I want to call a script within the process that sends the created flatfile as attachment via Mail using a smpt-server. The script should have the following input parameters:... (2 Replies)
Discussion started by: elko.hasse
2 Replies

7. Shell Programming and Scripting

sending mail error.. help

help i get this error when i sending a mail send-mail: fatal: open /etc/postfix/main.cf: No such file or directory Can't send mail: sendmail process failed this is my coding echo "$PRONAME is being restart" | mailxs "Subject:Process" "sally@$THISHOST" i wish to send this mail to my... (2 Replies)
Discussion started by: kkc
2 Replies

8. SuSE

How to configure Suse Enterprise Linux 9.0 for sending mails to smtp server...???

Hi All, I have a system running with Suse Enterprise Linux 9.0. xyz# uname -a Linux xyz 2.4.21-291-smp #1 SMP Tue May 24 14:07:45 UTC 2005 i686 unknown I would like to configure postfix on this system for sending mails as a root user using "mail" command to smtp server (Windows System)... (5 Replies)
Discussion started by: jumadhiya
5 Replies

9. HP-UX

Sending Error msg from HP-UX to E-mail address

Sometimes, for any reason, the UX System sends messages to /var/mail/root and/or to Error Log of the guardian. I'll appreciating if you help me to configure so that those messages are also sent to the System Administrator's e-mail address. Regards Gege (1 Reply)
Discussion started by: cgege
1 Replies

10. UNIX for Dummies Questions & Answers

Error when sending mail attachment

I have been sending an email attachment from my unix box, but keep getting an error? All though the recipient still receives the email and attachment. Will this error cause problems in the future and how to I cure it? $ uuencode PReSvPRINTER.txt file | mailx -s "File" me@world.com uuencode:... (1 Reply)
Discussion started by: dbrundrett
1 Replies
Login or Register to Ask a Question