Mail Name in Unsub form

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

Moderator: moderator

Mail Name in Unsub form

Postby daniel_jao » Tue Mar 22, 2011 10:23 am

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?
daniel_jao
 
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Postby maschoff » Tue Mar 22, 2011 8:08 pm

Have you tried script command
Code: Select all
$Mailing.getShortname

in your unsubscribe form?
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2144
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Mail Name in Unsub form

Postby daniel_jao » Wed Mar 23, 2011 3:39 am

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?
daniel_jao
 
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Postby maschoff » Mon Mar 28, 2011 1:41 pm

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
maschoff
Site Admin
 
Posts: 2144
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Mail Name in Unsub form

Postby daniel_jao » Mon Mar 28, 2011 2:14 pm

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.
daniel_jao
 
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Postby maschoff » Mon Mar 28, 2011 2:50 pm

There is no method getId(), but getMailingID(), getShortname(), etc.
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2144
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Mail Name in Unsub form

Postby daniel_jao » Mon Mar 28, 2011 7:03 pm

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.
daniel_jao
 
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Postby Hofmann M. » Tue Mar 29, 2011 8:56 am

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.
Hofmann M.
 
Posts: 21
Joined: Thu Aug 03, 2006 3:18 pm
Location: Ruhpolding, BY, Germany

Re: Mail Name in Unsub form

Postby daniel_jao » Tue Mar 29, 2011 3:57 pm

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.
daniel_jao
 
Posts: 10
Joined: Fri Mar 18, 2011 5:31 pm

Re: Mail Name in Unsub form

Postby maschoff » Tue Mar 29, 2011 4:38 pm

We will update the script action examples in the doc to make it clearer how to implement stuff like this.
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2144
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Mail Name in Unsub form

Postby daniel_jao » Tue Mar 29, 2011 5:29 pm

thanks!

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


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron