in reply to Re^3: Using Net::SMTP to send email attachments
in thread Using Net::SMTP to send email attachments

I tried this script but I got an error message, "EOH" seems to be undefined here....?

And, is the email sent from the web server instead of being transferred to the email server? My understanding is that emails that do not originate from specific email servers are regarded as spam and so binned.

Nice if we could get this to work though...

Thanks.

  • Comment on Re^4: Using Net::SMTP to send email attachments

Replies are listed 'Best First'.
Re^5: Using Net::SMTP to send email attachments
by kcott (Archbishop) on May 01, 2017 at 07:19 UTC
    "I tried this script but I got an error message, "EOH" seems to be undefined here....?"

    The second EOH needs to be on a line by itself, with no leading or trailing whitespace. See "perlop: Quote-Like Operators: here-document" for details.

    [For future reference, please post error messages, in their entirety, between <code>...</code> tags, so that we can see a verbatim copy: a synoptic, prosaic rendering of the message is typically not that helpful.]

    — Ken

Re^5: Using Net::SMTP to send email attachments
by shmem (Chancellor) on May 01, 2017 at 09:13 UTC
    I tried this script but I got an error message, "EOH" seems to be undefined here....?

    What error message do you get?

    And, is the email sent from the web server instead of being transferred to the email server?

    The message is sent from the machine where the script runs. Whether it is sent directly or transferred to the mail exchanger of this machine's domain depends on your mail configuration.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

      The error message is this:

      "Can't call method "datasend" on an undefined value at example2.cgi line 26, <> line 1."

      and line 26, line 1 was "$smtp->datasend(<<"EOH");"

      Thanks

      Geoffrey

        "Can't call method "datasend" on an undefined value at example2.cgi line 26, <> line 1."

        So it is not EOH, but $smtp which is not defined. Did you notice the ellipsis (...) in my example? These are placeholders for something that's been omitted for brevity, and you should add the bits needed, namely the initialization of $smtp and the protocol, and any other code to make that work.

        perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'