Mailing List Archive

Email tag / MIME:Lite
Hello

Not sure if anyone still gets these emails, but I could really do with some help.

I’m having problems with the [email] tag, specifically it seems when it calls MIME::Lite->new().

Everytime It gets to the call to create a new MIME message, interchange hangs until apache times out.

I have tried the same code in a [perl] block and it does the same thing, but as a native perl script outside of Interchange it works fine.

The [email] tag works fine for non-html email or emails with no attachments, because they do not use MIME.

The code below hangs until it times out.

[perl global=1 ]
use MIME::Lite;

$to = 'test@test.com';
$from= 'phil@interchange.co.uk';
$subject = 'Test Email';
$message = 'This is test email sent by Interchange’;

$msg = MIME::Lite->new('From' => "$from",
‘To’ => “$to”
);

return $msg ;
[/perl]

Any advice would be very helpful, I cannot see how this would hang, when the same code works fine in stand alone perl

Thanks in advance

Phil.



--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
> On Oct 3, 2020, at 12:05 PM, Phil Smith <phil.smith@phil-home.com> wrote:
>
> Hello
>
> Not sure if anyone still gets these emails, but I could really do with some help.
>
> I’m having problems with the [email] tag, specifically it seems when it calls MIME::Lite->new().
>
> Everytime It gets to the call to create a new MIME message, interchange hangs until apache times out.
>
> I have tried the same code in a [perl] block and it does the same thing, but as a native perl script outside of Interchange it works fine.
>
> The [email] tag works fine for non-html email or emails with no attachments, because they do not use MIME.
>
> The code below hangs until it times out.
>
> [perl global=1 ]
> use MIME::Lite;
>
> $to = 'test@test.com';
> $from= 'phil@interchange.co.uk';
> $subject = 'Test Email';
> $message = 'This is test email sent by Interchange’;
>
> $msg = MIME::Lite->new('From' => "$from",
> ‘To’ => “$to”
> );
>
> return $msg ;
> [/perl]
>
> Any advice would be very helpful, I cannot see how this would hang, when the same code works fine in stand alone perl
>
> Thanks in advance
>
> Phil.

Hi Phil,

Are you using the same To/From addresses in your test emails outside of interchange? (I assume so, just trying to think if there’s some way some sort of DNS issue is at play, as that’s my initial suspicion any time there are unexplained network delays.)

What versions of MIME::Lite/IC are you using?

Best,

David
--
David Christensen
Senior Software and Database Engineer
End Point Corporation
david@endpoint.com
785-727-1171
Re: Email tag / MIME:Lite [ In reply to ]
> On Oct 3, 2020, at 12:05 PM, Phil Smith <phil.smith@phil-home.com> wrote:
>
> Hello
>
> Not sure if anyone still gets these emails, but I could really do with some help.
>
> I’m having problems with the [email] tag, specifically it seems when it calls MIME::Lite->new().
>
> Everytime It gets to the call to create a new MIME message, interchange hangs until apache times out.
>
> I have tried the same code in a [perl] block and it does the same thing, but as a native perl script outside of Interchange it works fine.
>
> The [email] tag works fine for non-html email or emails with no attachments, because they do not use MIME.
>
> The code below hangs until it times out.
>
> [perl global=1 ]
> use MIME::Lite;
>
> $to = 'test@test.com';
> $from= 'phil@interchange.co.uk';
> $subject = 'Test Email';
> $message = 'This is test email sent by Interchange’;
>
> $msg = MIME::Lite->new('From' => "$from",
> ‘To’ => “$to”
> );
>
> return $msg ;
> [/perl]
>
> Any advice would be very helpful, I cannot see how this would hang, when the same code works fine in stand alone perl
>
> Thanks in advance
>
> Phil.

Hi Phil,

Are you using the same To/From addresses in your test emails outside of interchange? (I assume so, just trying to think if there’s some way some sort of DNS issue is at play, as that’s my initial suspicion any time there are unexplained network delays.)

What versions of MIME::Lite/IC are you using?

Best,

David
--
David Christensen
Senior Software and Database Engineer
End Point Corporation
david@endpoint.com
785-727-1171
Re: Email tag / MIME:Lite [ In reply to ]
-- snip --
> Everytime It gets to the call to create a new MIME message, interchange hangs until apache times out.
>
> I have tried the same code in a [perl] block and it does the same thing, but as a native perl script outside of Interchange it works fine.
>
> The [email] tag works fine for non-html email or emails with no attachments, because they do not use MIME.
-- snip --
>
>Hi Phil,
>
>Are you using the same To/From addresses in your test emails outside of interchange? (I assume so, just trying to think >if there’s some way some sort of DNS issue is at play, as that’s my initial suspicion any time there are unexplained >network delays.)
>
>What versions of MIME::Lite/IC are you using?
>
>Best,
>
>David

Apologies if this email is formatted weird, my email client is messed up.

I have tried this on an old working install of IC and there its is fine, so I’m guessing there is now an incompatibility between IC/perl/MIME::lite?

My New server (hangs in IC) is Perl 5.20.2, MIME::Lite 3.031, IC 5.10.0

My old server (working fine) is Perl 5.8.8, MIMI::Lite 3.01, IC 5.7.2

As a standalone perl script the same code works fine on both servers, just when ran thru IC (in a [perl] block in a page, as a UserTag or in the test_code admin page) it hangs on the MIME::Lite->new() creation of the object.

Any more advice greatly received.

Phil.




--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
> On Oct 5, 2020, at 9:58 AM, Phil Smith <phil.smith@phil-home.com> wrote:
>
> -- snip --
> > Everytime It gets to the call to create a new MIME message, interchange hangs until apache times out.
> >
> > I have tried the same code in a [perl] block and it does the same thing, but as a native perl script outside of Interchange it works fine.
> >
> > The [email] tag works fine for non-html email or emails with no attachments, because they do not use MIME.
> -- snip --
> >
> >Hi Phil,
> >
> >Are you using the same To/From addresses in your test emails outside of interchange? (I assume so, just trying to think >if there’s some way some sort of DNS issue is at play, as that’s my initial suspicion any time there are unexplained >network delays.)
> >
> >What versions of MIME::Lite/IC are you using?
> >
> >Best,
> >
> >David
>
> Apologies if this email is formatted weird, my email client is messed up.
>
> I have tried this on an old working install of IC and there its is fine, so I’m guessing there is now an incompatibility between IC/perl/MIME::lite?
>
> My New server (hangs in IC) is Perl 5.20.2, MIME::Lite 3.031, IC 5.10.0
>
> My old server (working fine) is Perl 5.8.8, MIMI::Lite 3.01, IC 5.7.2
>
> As a standalone perl script the same code works fine on both servers, just when ran thru IC (in a [perl] block in a page, as a UserTag or in the test_code admin page) it hangs on the MIME::Lite->new() creation of the object.
>
> Any more advice greatly received.

Hi Phil,

What is the type of data that you are including in the test messages; ASCII only or hi-bit data? Do you have any of MT_UTF8, MV_HTTP_CHARSET or MV_EMAIL_CHARSET set in your catalog or interchange configuration?

Best,

David
--
David Christensen
Senior Software and Database Engineer
End Point Corporation
david@endpoint.com
785-727-1171
Re: Email tag / MIME:Lite [ In reply to ]
>Hi Phil,
>
>What is the type of data that you are including in the test messages; ASCII only or hi-bit data? Do you have any of >MT_UTF8, MV_HTTP_CHARSET or MV_EMAIL_CHARSET set in your catalog or interchange configuration?
>
>Best,
>
>David

The message was simply “This is test email sent by Interchange” so should be plain old ASCII.

I have ‘Variable MV_UTF8 1’ & ‘Variable MV_HTTP_CHARSET utf-8’ set in catalog.cfg, but MV_EMAIL_CHARSET is not set anywhere.

However, the test case hangs everytime when when the simple stripped down “my $msg = MIME::Lite->new('From'=> "$from",'To' => "$to" )” in a [perl] block, which I don’t think would be affected by any of those configs.

I have noticed from the guy who developed MIME::Lite, that he no longer recommends it, and there were too many bug with it. He recommends other Perl Modules instead, but I don’t really want to re-write the [email] tag if it is still working for everyone else?

Can you confirm if you still use the [email] tag in working catalogs?

Phil.




--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
On 6/10/20 3:58 am, Phil Smith wrote:
> As a standalone perl script the same code works fine on both servers,
> just when ran thru IC (in a [perl] block in a page, as a UserTag or in
> the test_code admin page) it hangs on the MIME::Lite->new() creation of
> the object.

I suspect that this might be a Safe issue. The first thing I would
check is the SafeUntrap directive in interchange.cfg, make sure there
isn't anything you've untrapped in the old catalog that isn't listed in
the new one.

Also try calling the email tag from outside of the [perl] block, just
with ITL. If this works then it's very likely going to be Safe.

Other than that it could just be changes in perl, Safe issues are hard
to track down and things sometimes go awry in newer versions of perl.
There are others here who are likely better at dealing with Safe issues
than I am, my preferred method is to rewrite code where necessary so
it's outside of [perl] and [calc] blocks and get on with my day.


Peter
_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Email tag / MIME:Lite [ In reply to ]
>> As a standalone perl script the same code works fine on both servers,
>> just when ran thru IC (in a [perl] block in a page, as a UserTag or in
>> the test_code admin page) it hangs on the MIME::Lite->new() creation of
>> the object.

>I suspect that this might be a Safe issue. The first thing I would
>check is the SafeUntrap directive in interchange.cfg, make sure there
>isn't anything you've untrapped in the old catalog that isn't listed in
>the new one.

>Also try calling the email tag from outside of the [perl] block, just
>with ITL. If this works then it's very likely going to be Safe.

>Other than that it could just be changes in perl, Safe issues are hard
>to track down and things sometimes go awry in newer versions of perl.
>There are others here who are likely better at dealing with Safe issues
>than I am, my preferred method is to rewrite code where necessary so
>it's outside of [perl] and [calc] blocks and get on with my day.

>Peter

There was a load of untrapped modules in the old catalog, I have added them to the new catalog and it still hangs in the same place.

I have also tried a plain page, with just the [email] tag in, so not wrapping it with [perl] or [calc], and again it hangs in the same place until apache times out.

I may have to write my own version of the [email] tag using a different module than MIME::Lite, even the developer of MIME::Lite recommends that. “MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else.” – taken from his CPAN page.

But I cannot believe that no-one else uses the IC [email] tag anymore?

Can anyone confirm it working on their catalo, and which versions of perl/IC/MIME::Lite they have?


Thanks

Phil.


--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
>>> As a standalone perl script the same code works fine on both servers,
>>> just when ran thru IC (in a [perl] block in a page, as a UserTag or in
>>> the test_code admin page) it hangs on the MIME::Lite->new() creation of
>>> the object.

>>I suspect that this might be a Safe issue. The first thing I would
>>check is the SafeUntrap directive in interchange.cfg, make sure there
>>isn't anything you've untrapped in the old catalog that isn't listed in
>>the new one.

>>Also try calling the email tag from outside of the [perl] block, just
>>with ITL. If this works then it's very likely going to be Safe.

>>Other than that it could just be changes in perl, Safe issues are hard
>>to track down and things sometimes go awry in newer versions of perl.
>>There are others here who are likely better at dealing with Safe issues
>>than I am, my preferred method is to rewrite code where necessary so
>>it's outside of [perl] and [calc] blocks and get on with my day.

>>Peter

>There was a load of untrapped modules in the old catalog, I have added them to the new catalog and it still hangs in the same >place.

>I have also tried a plain page, with just the [email] tag in, so not wrapping it with [perl] or [calc], and again it hangs in the same >place until apache times out.

>I may have to write my own version of the [email] tag using a different module than MIME::Lite, even the developer of >MIME::Lite recommends that. “MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, >like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue >weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please >consider using something else.” – taken from his CPAN page.
>
>But I cannot believe that no-one else uses the IC [email] tag anymore?
>
>Can anyone confirm it working on their catalo, and which versions of perl/IC/MIME::Lite they have?
Hi Paul,

Would it work for you to try to see if sending mail works with email_raw tag?
https://github.com/interchange/interchange/blob/master/code/UserTag/email_raw.tag

Call it like:
[email-raw][include etc/my_template][/email-raw]

And then in
etc/my_template have the mail, you can see the example for this here:
https://github.com/interchange/interchange/blob/master/dist/strap/etc/ship_notice

CU,

Gert


_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Email tag / MIME:Lite [ In reply to ]
Paul = Phil duh hehe ... Sorry Pat! :)

> -----Original Message-----
> From: interchange-users [mailto:interchange-users-
> bounces@interchangecommerce.org] On Behalf Of Gert van der Spoel
> Sent: Tuesday, October 6, 2020 13:45
> To: interchange-users@interchangecommerce.org
> Subject: Re: [ic] Email tag / MIME:Lite
>
> >>> As a standalone perl script the same code works fine on both
> >>> servers, just when ran thru IC (in a [perl] block in a page, as a
> >>> UserTag or in the test_code admin page) it hangs on the
> >>> MIME::Lite->new() creation of the object.
>
> >>I suspect that this might be a Safe issue. The first thing I would
> >>check is the SafeUntrap directive in interchange.cfg, make sure there
> >>isn't anything you've untrapped in the old catalog that isn't listed
> >>in the new one.
>
> >>Also try calling the email tag from outside of the [perl] block, just
> >>with ITL. If this works then it's very likely going to be Safe.
>
> >>Other than that it could just be changes in perl, Safe issues are hard
> >>to track down and things sometimes go awry in newer versions of perl.
> >>There are others here who are likely better at dealing with Safe
> >>issues than I am, my preferred method is to rewrite code where
> >>necessary so it's outside of [perl] and [calc] blocks and get on with my day.
>
> >>Peter
>
> >There was a load of untrapped modules in the old catalog, I have added them
> to the new catalog and it still hangs in the same >place.
>
> >I have also tried a plain page, with just the [email] tag in, so not wrapping it
> with [perl] or [calc], and again it hangs in the same >place until apache times
> out.
>
> >I may have to write my own version of the [email] tag using a different
> module than MIME::Lite, even the developer of >MIME::Lite recommends that.
> “MIME::Lite is not recommended by its current maintainer. There are a
> number of alternatives, >like Email::MIME or MIME::Entity and Email::Sender,
> which you should probably use instead. MIME::Lite continues to accrue >weird
> bug reports, and it is not receiving a large amount of refactoring due to the
> availability of better alternatives. Please >consider using something else.” –
> taken from his CPAN page.
> >
> >But I cannot believe that no-one else uses the IC [email] tag anymore?
> >
> >Can anyone confirm it working on their catalo, and which versions of
> perl/IC/MIME::Lite they have?
> Hi Paul,
>
> Would it work for you to try to see if sending mail works with email_raw tag?
> https://github.com/interchange/interchange/blob/master/code/UserTag/emai
> l_raw.tag
>
> Call it like:
> [email-raw][include etc/my_template][/email-raw]
>
> And then in
> etc/my_template have the mail, you can see the example for this here:
> https://github.com/interchange/interchange/blob/master/dist/strap/etc/ship
> _notice
>
> CU,
>
> Gert
>
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchangecommerce.org
> https://www.interchangecommerce.org/mailman/listinfo/interchange-users

_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Email tag / MIME:Lite [ In reply to ]
On 10/6/20 12:13 PM, Phil Smith wrote:
>>> As a standalone perl script the same code works fine on both servers,
>
>>> just when ran thru IC (in a [perl] block in a page, as a UserTag or in
>
>>> the test_code admin page) it hangs on the MIME::Lite->new() creation of
>
>>> the object.
>
>  
>
>>I suspect that this might be a Safe issue.  The first thing I would
>
>>check is the SafeUntrap directive in interchange.cfg, make sure there
>
>>isn't anything you've untrapped in the old catalog that isn't listed in
>
>>the new one.
>
>  
>
>>Also try calling the email tag from outside of the [perl] block, just
>
>>with ITL.  If this works then it's very likely going to be Safe.
>
>  
>
>>Other than that it could just be changes in perl, Safe issues are hard
>
>>to track down and things sometimes go awry in newer versions of perl.
>
>>There are others here who are likely better at dealing with Safe issues
>
>>than I am, my preferred method is to rewrite code where necessary so
>
>>it's outside of [perl] and [calc] blocks and get on with my day.
>
>  
>
>>Peter
>
>  
>
> There was a load of untrapped modules in the old catalog, I have added them to the new catalog and it still hangs in the
> same place.
>
>  
>
> I have also tried a plain page, with just the [email] tag in, so not wrapping it with [perl] or [calc], and again it
> hangs in the same place until apache times out.
>
>  
>
> I may have to write my own version of the [email] tag using a different  module than MIME::Lite, even the developer of
> MIME::Lite recommends that. “MIME::Lite is not recommended by its current maintainer. There are a number of
> alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite
> continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of
> better alternatives. Please consider using something else.” – taken from his CPAN page.
>
>  
>
> But I cannot believe that no-one else uses the IC [email] tag anymore?
>
>  
>
> Can anyone confirm it working on their catalo, and which versions of perl/IC/MIME::Lite they have?

I never encountered your problem with [email], regardless of MIME::Lite version, but I run my catalogs
always in global mode:

AllowGlobal myshop
PerlAlwaysGlobal myshop

Currently I'm using Email::Sender from within a global usertag.

Regards
Racke


>
>  
>
>  
>
> Thanks
>
>  
>
> Phil.
>
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> Virus-free. www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchangecommerce.org
> https://www.interchangecommerce.org/mailman/listinfo/interchange-users
>


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
Re: Email tag / MIME:Lite [ In reply to ]
--Snip --
> Hi Paul,
>
> Would it work for you to try to see if sending mail works with email_raw tag?
> https://github.com/interchange/interchange/blob/master/code/UserTag/email_raw.tag
>
>Call it like:
>[email-raw][include etc/my_template][/email-raw]
>
>And then in
>etc/my_template have the mail, you can see the example for this here:
>https://github.com/interchange/interchange/blob/master/dist/strap/etc/ship_notice
>
>CU,
>
>Gert

Hi Gert/Bert :-)

[email_raw] works ok, as it doesn’t use MIME::Lite at all, I can send basic emails using that.

However, this I was asked to look into email because we need to be able email PDF attachments, which will require MIME of some sort.

Regards
Phil.



--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
>> Can anyone confirm it working on their catalo, and which versions of perl/IC/MIME::Lite they have?

>I never encountered your problem with [email], regardless of MIME::Lite version, but I run my catalogs
>always in global mode:

>AllowGlobal myshop
>PerlAlwaysGlobal myshop

>Currently I'm using Email::Sender from within a global usertag.

>Regards
> Racke

Hi Racke

I also run this catalog in AllowGlobal, but it is still getting upset about something and hanging.

Would you be willing to share your new Global UserTag using Email::Sender? It may be better for me to just move away from MIIME::Lite all togerther.

Phil.


--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
On Tue, 6 Oct 2020, Phil Smith wrote:

> But I cannot believe that no-one else uses the IC [email] tag anymore?
>
> Can anyone confirm it working on their catalo, and which versions of
> perl/IC/MIME::Lite they have?

Phil,

I checked an Interchange codebase I work on that still uses [email].

This site's emailing functions either use [email-raw] or a global usertag
that calls ::interpolate_html() on the contents of an ITL template that
calls [email]. So it's outside of Safe entirely.

They don't use [email] in any Safe code that I can find, which gives
further support for David's and Peter's suggestions that you may have a
Safe problem.

That is on Perl 5.22.0 + Interchange 5.10.0.

However, the [email] tag still works in Safe code on the stock Strap demo
catalog, at least on the demo server. I just tested it here:

https://demo.interchangecommerce.org/i/demo/lost_password

and it sent out the email as expected.

That is a normal [email] tag in the file:

dist/strap/pages/member/get_password.html

It is running on Perl 5.28.1 + latest Interchange Git code.

You can of course stop using MIME::Lite, but I think this is just a Safe
problem.

Jon



--
Jon Jensen
End Point Corporation
https://www.endpoint.com/
_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Email tag / MIME:Lite [ In reply to ]
>However, the [email] tag still works in Safe code on the stock Strap demo
>catalog, at least on the demo server. I just tested it here:
>
>https://demo.interchangecommerce.org/i/demo/lost_password
>
>and it sent out the email as expected.
>
>That is a normal [email] tag in the file:
>
>dist/strap/pages/member/get_password.html
>
>It is running on Perl 5.28.1 + latest Interchange Git code.>
>
>You can of course stop using MIME::Lite, but I think this is just a Safe
>problem.
>
>Jon

Hi thank you for this, but as far as I can tell the [email] in lost_password does not send MIME email, hat section is only processed if it has an attachment (why I needed it) or its marked as a HTML multi-part email.

Phil.


--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
On Tue, 6 Oct 2020, Phil Smith wrote:

>> However, the [email] tag still works in Safe code on the stock Strap
>> demo catalog, at least on the demo server.
>
> Hi thank you for this, but as far as I can tell the [email] in
> lost_password does not send MIME email, hat section is only processed if
> it has an attachment (why I needed it) or its marked as a HTML
> multi-part email.

I think you're right about that. So it doesn't look like any of the
[email] calls in the Strap demo use MIME::Lite.

Jon


--
Jon Jensen
End Point Corporation
https://www.endpoint.com/
_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Email tag / MIME:Lite [ In reply to ]
>I think you're right about that. So it doesn't look like any of the
>[email] calls in the Strap demo use MIME::Lite.
>
>Jon

It looks like MIME::Lite is no longer working within Interchange, would anyone please share their replacement UserTags, before I hack my own together.

I have a simple [perl] block working, usinf Mail::Sendmail, which will probably do the job, I will flwesh it out to a UserTag with some sanity checks. But would be nice to see anyone else’s UserTags that may be more elegant/stable.

[perl global=1]
use MIME::QuotedPrint;
use MIME::Base64;
use Mail::Sendmail;
my %mail = ( from => 'phil@example.com', to => 'phil@hotmail.com', subject => 'Test from IC'
);

my $boundary = "====" . time() . "====";
$mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\"";

my $message = encode_qp( "<h1>This is a test email.</h1>");

my $file = "/var/www/html/IC/test.pdf";

open (F, $file) or die "Cannot read $file: $!";
binmode F; undef $/;
$mail{body} = encode_base64(<F>);
close F;

my $boundary = '--'.$boundary;
$mail{body} = <<END_OF_BODY;
$boundary
Content-Type: text/HTML; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

$message
$boundary
Content-Type: application/octet-stream; name="$^X"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Complaints.pdf"

$mail{body}
$boundary--
END_OF_BODY

sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
[/perl]


--
This email has been checked for viruses by AVG.
https://www.avg.com
Re: Email tag / MIME:Lite [ In reply to ]
On 8/10/20 11:59 pm, Phil Smith wrote:
> It looks like MIME::Lite is no longer working within Interchange, would
> anyone please share their replacement UserTags, before I hack my own
> together.

Just to show that it does I have perl 5.24.0 with this code in IC:

[tmp success][email
from=`$Scratch->{email_from}`
to=`$Scratch->{Email}`
subject=`$Scratch->{subject}`
html=`$Scratch->{html_part}`
][scratch text_part][/email][/tmp]

It needs Mime::Lite for the html part there. I did have to modify the
email tag, but not for this issue, it had to do with an encoding issue
in the headers:

--- email.tag~ 2016-10-20 10:21:17.000000000 +0000
+++ email.tag 2019-07-15 17:11:05.915000000 +0000
@@ -93,14 +93,15 @@
my @extra_headers;

# encode values if utf8 is supported
- if($utf8){
- $to = utf8_to_other($to, 'MIME-Header');
- $from = utf8_to_other($from, 'MIME-Header');
- $subject = utf8_to_other($subject, 'MIME-Header');
- $cc = utf8_to_other($cc, 'MIME-Header');
- $bcc = utf8_to_other($bcc, 'MIME-Header');
- $reply = utf8_to_other($reply, 'MIME-Header');
- }
+ # We can't encode these!
+# if($utf8){
+# $to = utf8_to_other($to, 'MIME-Header');
+# $from = utf8_to_other($from, 'MIME-Header');
+# $subject = utf8_to_other($subject, 'MIME-Header');
+# $cc = utf8_to_other($cc, 'MIME-Header');
+# $bcc = utf8_to_other($bcc, 'MIME-Header');
+# $reply = utf8_to_other($reply, 'MIME-Header');
+# }

my %msg_args = (To => $to,
From => $from,
@@ -127,6 +128,7 @@
$msg_args{Type} ||= 'multipart/mixed';
}

+ $msg_args{Encoding} = '8bit';
my $msg = MIME::Lite->new(%msg_args);

for(@extra) {



Peter
_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Email tag / MIME:Lite [ In reply to ]
>Just to show that it does I have perl 5.24.0 with this code in IC:
>
>[tmp success][email
> from=`$Scratch->{email_from}`
> to=`$Scratch->{Email}`
> subject=`$Scratch->{subject}`
> html=`$Scratch->{html_part}`
>][scratch text_part][/email][/tmp]

>It needs Mime::Lite for the html part there. I did have to modify the
>email tag, but not for this issue, it had to do with an encoding issue
>in the headers:

>--- email.tag~ 2016-10-20 10:21:17.000000000 +0000
>+++ email.tag 2019-07-15 17:11:05.915000000 +0000
>@@ -93,14 +93,15 @@
> my @extra_headers;
>
> # encode values if utf8 is supported
>- if($utf8){
>- $to = utf8_to_other($to, 'MIME-Header');
>- $from = utf8_to_other($from, 'MIME-Header');
>- $subject = utf8_to_other($subject, 'MIME-Header');
>- $cc = utf8_to_other($cc, 'MIME-Header');
>- $bcc = utf8_to_other($bcc, 'MIME-Header');
>- $reply = utf8_to_other($reply, 'MIME-Header');
>- }
>+ # We can't encode these!
>+# if($utf8){
>+# $to = utf8_to_other($to, 'MIME-Header');
>+# $from = utf8_to_other($from, 'MIME-Header');
>+# $subject = utf8_to_other($subject, 'MIME-Header');
>+# $cc = utf8_to_other($cc, 'MIME-Header');
>+# $bcc = utf8_to_other($bcc, 'MIME-Header');
>+# $reply = utf8_to_other($reply, 'MIME-Header');
>+# }
>
> my %msg_args = (To => $to,
> From => $from,
>@@ -127,6 +128,7 @@
> $msg_args{Type} ||= 'multipart/mixed';
> }
>
>+ $msg_args{Encoding} = '8bit';
> my $msg = MIME::Lite->new(%msg_args);
>
> for(@extra) {
>
>Peter

Thank you Peter, but even with that patch my version still hangs on the same point. The only difernce I can see between yours and mine is the perl version. These servers are on 5.20.2, while you are on 5.24.0. Im a little worried about updating perl on these servers, in case it causes any other compatability problems on my LIVE server.

Phil.


--
This email has been checked for viruses by AVG.
https://www.avg.com