Mail Name in Unsub form

Use this forum for all questions related to the source code of OpenEMM

Moderator: moderator

daniel_jao
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Mail Name in Unsub form

Post by daniel_jao »

Hi, is this possible, displaying the Mail name in the unsubscribe step 1 form?

please point me to the correct direction.. can we use script action in the form itself?
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Mail Name in Unsub form

Post by maschoff »

Have you tried script command

Code: Select all

$Mailing.getShortname
in your unsubscribe form?
OpenEMM Maintainer
daniel_jao
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Post by daniel_jao »

I have this unsub form and i included that script comment, its not working unless im doing it wrong:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<head>
<title>newsletter unsubscribe</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
body, table { font-family: Tahoma, Helvetica, sans-serif; font-size: 12px; }
h1 { font-family: Tahoma, Helvetica, sans-serif; font-size: 16px; }
select, input { font-family: Tahoma, Helvetica, sans-serif; font-size: 12px;}
select { width: 200px; }
-->
</style>
</head>

<body bgcolor="#C0C0C0" link="#bb2233" vlink="#bb2233" alink="#bb2233">
<table width="480" border="0" align="center" cellpadding="2" cellspacing="0">
<tr bgcolor="#808080">
<td bgcolor="#808080">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td>
<form action="form.do">
<input type="hidden" name="agnCI" value="1">
<input type="hidden" name="agnFN" value="en_unsub_confirm">
<input type="hidden" name="agnUID" value="$!agnUID">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="10">&nbsp;</td>





<td><h1><strong>$Mailing.getShortname</strong>UNSUBSCRIBE NEWSLETTER 1/2</h1>
<p>Do you really want to unsubscribe from our newsletter?</p>
<table border=0>
<tr><td width="120"><input type="submit" value=" Yes "></td>
<td><input type="reset" value=" No " onClick="javascript:history.back();"></td></tr>
</table>
</td>
<td width="10">&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
maschoff wrote:Have you tried script command

Code: Select all

$Mailing.getShortname
in your unsubscribe form?
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Mail Name in Unsub form

Post by maschoff »

You have to load the mailing object first with something like

Code: Select all

#set($mail=$MailingDao.getMailing(ID, 1)
But this would not help since you do not have the mailing ID (it is encoded in the UID, but there is no decode method available.
OpenEMM Maintainer
daniel_jao
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Post by daniel_jao »

i managed to include the mailing id in the url, so i should be able to get the mailing already, but not working still: ($mail seems is not getting the value, because when i access th page, im getting the $mail.getId() being printed out in the page)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<head>
<title>newsletter unsubscribe</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
body, table { font-family: Tahoma, Helvetica, sans-serif; font-size: 12px; }
h1 { font-family: Tahoma, Helvetica, sans-serif; font-size: 16px; }
select, input { font-family: Tahoma, Helvetica, sans-serif; font-size: 12px;}
select { width: 200px; }
-->
</style>
</head>

<body bgcolor="#C0C0C0" link="#bb2233" vlink="#bb2233" alink="#bb2233">
<table width="480" border="0" align="center" cellpadding="2" cellspacing="0">
<tr bgcolor="#808080">
<td bgcolor="#808080">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td>
<form action="form.do">
<input type="hidden" name="agnCI" value="1">
<input type="hidden" name="agnFN" value="en_unsub_confirm">
<input type="hidden" name="agnUID" value="$!agnUID">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="10">&nbsp;</td>




#set ($mail=$MailingDao.getMailing(100, 1))
<td><h1><strong>$mail.getId()</strong>UNSUBSCRIBE NEWSLETTER 1/2</h1>
<p>Do you really want to unsubscribe from our newsletter?</p>
<table border=0>
<tr><td width="120"><input type="submit" value=" Yes "></td>
<td><input type="reset" value=" No " onClick="javascript:history.back();"></td></tr>
</table>
</td>
<td width="10">&nbsp;</td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
maschoff wrote:You have to load the mailing object first with something like

Code: Select all

#set($mail=$MailingDao.getMailing(ID, 1)
But this would not help since you do not have the mailing ID (it is encoded in the UID, but there is no decode method available.
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Mail Name in Unsub form

Post by maschoff »

There is no method getId(), but getMailingID(), getShortname(), etc.
OpenEMM Maintainer
daniel_jao
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Post by daniel_jao »

ok.. i tried changing to this:

#set ($mail=$MailingDao.getMailing(100, 1))
<td><h1><strong>$mail.getShortname()</strong>UNSUBSCRIBE NEWSLETTER 1/2</h1>

and im just getting this printed out:


$mail.getShortname()UNSUBSCRIBE NEWSLETTER 1/2

Do you really want to unsubscribe from our newsletter?

it doesnt give me the shortname equivalent value. im sure that the mail id is 100 and is associated with company id 1. so what am i doing wrong?
maschoff wrote:There is no method getId(), but getMailingID(), getShortname(), etc.
Hofmann M.
Posts: 22
Joined: Thu Aug 03, 2006 3:18 pm
Location: Ruhpolding, BY, Germany
Contact:

Re: Mail Name in Unsub form

Post by Hofmann M. »

Hello @ all,

i have tried it on my system and it works.
I have used zwo parts: 1x action, 1x form

Action: shortname
step 1: script-action

Code: Select all

#set($mail=$MailingDao.getMailing([Mailing_ID], 1))

#set($scriptResult="1")
[Mailing_ID] = your mailing_id

Form:
aktion: shortname
Success-Form:

Code: Select all

<h1><strong>$mail.getShortname()</strong>UNSUBSCRIBE NEWSLETTER 1/2</h1>
If i call now the url like http://yourdomain.com/form.do&agnCI=1&agnFN=[form-name]
i get the shortname of the mailing.

Greetings.
daniel_jao
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Post by daniel_jao »

finally i was able to make it work.. needed to convert the parameter to integer, thanks!
Hofmann M. wrote:Hello @ all,

i have tried it on my system and it works.
I have used zwo parts: 1x action, 1x form

Action: shortname
step 1: script-action

Code: Select all

#set($mail=$MailingDao.getMailing([Mailing_ID], 1))

#set($scriptResult="1")
[Mailing_ID] = your mailing_id

Form:
aktion: shortname
Success-Form:

Code: Select all

<h1><strong>$mail.getShortname()</strong>UNSUBSCRIBE NEWSLETTER 1/2</h1>
If i call now the url like http://yourdomain.com/form.do&agnCI=1&agnFN=[form-name]
i get the shortname of the mailing.

Greetings.
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Mail Name in Unsub form

Post by maschoff »

We will update the script action examples in the doc to make it clearer how to implement stuff like this.
OpenEMM Maintainer
daniel_jao
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Post by daniel_jao »

thanks!
maschoff wrote:We will update the script action examples in the doc to make it clearer how to implement stuff like this.
Post Reply