EPrints Technical Mailing List Archive

Message: #05586


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Adding a pin to a subject line using User->Mail


Ah… that might explain my code then…

 

I’ve got a ‘status_change’ trigger – but I don’t use the $user->mail method (I was wondering why not!).

 

I construct the send_mail block in the trigger sub (much like the $user->mail block does) – which works OK.

 

Hope that helps (sorry it’s not a DRY solution!).

 

Cheers,

John

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Vials Moore, Adam
Sent: 21 April 2016 15:14
To: 'eprints-tech@ecs.soton.ac.uk' <eprints-tech@ecs.soton.ac.uk>
Subject: Re: [EP-tech] Adding a pin to a subject line using User->Mail

 

Hi John!

 

Thanks – that puts in the value BUT then complains that the phrase is undefined – the difference between USER::Mail and send_mail being, as far as I can see, that user->mail expects ONLY a reference to a phrase in the subject, whereas send_mail expects a UTF8 string

 

So, the subject when it arrives now looks like this:

[" [Action Required] New thesis upload by your supervisee (Ref 3000014) "   not defined]

 

Which, as far as I can understand, is a complaint that the phrase defined by the string above doesn’t exist . . .

 

I’ve updated the code in line with your suggestions otherwise . . .

 

The complaint in the log would back this up

[uolrepo] Undefined phrase:  [Action Required] New thesis upload by your supervisee (Ref 3000014)  (en) at line 124 in (eval 4489)

 

Or have I missed something?

 

Adam

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of John Salter
Sent: 21 April 2016 13:50
To: eprints-tech@ecs.soton.ac.uk
Subject: Re: [EP-tech] Adding a pin to a subject line using User->Mail

 

Hi Adam,

You can use a phrase with pins – but need to make sure you’re using a chunk of text rather than an XML fragment (possibly using the ‘phrase’ rather than ‘html_phrase’)

 

$user->mail(

    $session->phrase(

        “phrase_with_eprintid_pin_in_it”,

        eprintid => $eprintid,

    ),

)

 

If you want to use other data, that’s already rendered you might need to ‘flatten’ it to use it:

 

$user->mail(

    $session->phrase(

        “phrase_with_users_name_pin_in_it”,

        users_name => EPrints::Utils::tree_to_utf8( $users_name ),

    ),

),

 

Cheers,

John

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Vials Moore, Adam
Sent: 21 April 2016 13:26
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Adding a pin to a subject line using User->Mail

 

Hey all!

 

I’m trying to send an email notification about an item using the user->mail method

 

This uses a phrase as the subject HOWEVER I’d really like to set the eprintid and I can’t figure out a way to define it, as the method seems only to allow the phrase as part of the call

 

So – at the moment it looks like:

 my $result = $user->mail( "eprint_thesis_notify_mail_subject", $mail );