fizzer666
asked on
Changing the MailDefinition.BodyFileName of PasswordRecovery control programmatically?
Hi,
I have a passwordRecovery control and a custom text file which contains the Body of the email. I get the email fine if I specify the File name at design time in the MailDefinition of the PasswordRecovery control:
<MailDefinition From="info@Intamac.com" Subject="Your New Password" BodyFileName="PasswordMail .txt">
</MailDefinition>
However I need to set the Text file at runtime based on the users current theme. I have tried to do this in the PasswordRecovery's sendingMail event but this just sends the default email out. ie (doesn't apply the text file) here's what i'm doing:
Protected Sub PswdRecovery_SendingMail(B yVal sender As Object, ByVal e As System.Web.UI.WebControls. MailMessag eEventArgs ) Handles PswdRecovery.SendingMail
Me.PswdRecovery.MailDefini tion.BodyF ileName = "PasswordMail.txt"
End Sub
The text file is in the same dir as the page so this isn't the problem. Any ideas?
I have a passwordRecovery control and a custom text file which contains the Body of the email. I get the email fine if I specify the File name at design time in the MailDefinition of the PasswordRecovery control:
<MailDefinition From="info@Intamac.com" Subject="Your New Password" BodyFileName="PasswordMail
</MailDefinition>
However I need to set the Text file at runtime based on the users current theme. I have tried to do this in the PasswordRecovery's sendingMail event but this just sends the default email out. ie (doesn't apply the text file) here's what i'm doing:
Protected Sub PswdRecovery_SendingMail(B
Me.PswdRecovery.MailDefini
End Sub
The text file is in the same dir as the page so this isn't the problem. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is there a problem if the BodyFileName is set twice?
Bob
Bob
ASKER
It doesn't effect the outcome but I just wondered whether there was a more efficient way. In this instance, your right, I suppose it's not much of a perfomance hit. Thanks for your help.
ASKER
If Not Page.IsPostBack Then
Me.PswdRecovery.MailDefini
End If
This didn't work unless I take it out of the if condition. At least now it works but this will fire multiple times. Is there an event I can use which will only fire this once?