+ Start a Discussion
Andrew TelfordAndrew Telford 

dynamic reply to field in visualforce email template

I ma trying to get the reply-to field in a visualforce email. My hope is to be able to call a class function which I have that will check the value I pass to it and add the email address accordingly.
 
<messaging:emailTemplate subject="Product Upgrade Boardroom Session"
    recipientType="Contact"
    relatedToType="CampaignMember"
    replyTo="DYNAMCIALLY CHANGE VIA CALL TO CLASS FUNCTION (ci_class.emailFromAddress(passedValue)">
 
PUBLIC STRING emailFromAddress ( STRING strSender )
	{
		STRING strEMail = NULL;
		//--	Set the mapping for the Sender / Email
		//--	--------------------------------------------------------------------------------------------------------
		MAP<STRING, STRING> senderMap = NEW MAP<STRING, STRING>();	//--	Stores Key Value Pairs
		senderMap.put('Sales NSW/ACT', 'nswactsales@yy.com.au');
		senderMap.put('Sales QLD', 'qldsales@yy.com.au');
        senderMap.put('Sales VIC/TAS', 'victassales@yy.com.au');
        senderMap.put('Sales WA/SA/NT', 'wastatesales@yy.com.au');
		senderMap.put('National', 'xx@yy.com.au');

		IF( senderMap.containsKey( strSender ) )
		{
			strEmail = senderMap.get( strSender );
			RETURN strEmail;
		}
		ELSE
		{	RETURN strEMail;	}
		
	}

Was thinking of calling a component but it doesn't allow me to call that inside the message tags.

Any thoughts??