GSP4US6;4574 wrote:A way to choose to be notified if someone updates a Gallery. Possibly the email could tell you whet just happen to the Gallery... Who, user name, did what and when to the gallery.
Not sure how far to take this, but allot of forums operate this way were you can choose to be notified when a topic updates. Maybe a per Gallery or Album / Object option with a global setting that would allow you to say that by default I want to be notified of any and all changes, of only all uploads, of only deletions?? Or by default, do not notify me of anything, I'll pick what I want on a case-by-case bases....
With my new Gallery, I find myself constantly logging in to see if someone has use the system.
I'm sure Roger will come up with a better 'official' method, but I've been playing around with adding this feature to my install last week to send me an email when an item is added. Again, it's a bit forced, and i'm sure it's in the wrong place, and has limitations, but it seems to work so far. Also, note that this is for version 2.4, so there's a chance it's not compatible with newer versions.
How: I added this code to the bottom of the save method of the MediaObject.CS in the TIS.GSP.DATA.SQLSERVER folder, right before "mediaObjectId;"
If you want to give it a try, you'll just have to fill in the variables with your SMTP settings and remember to change your URL paths (localhost) to reflect your website, if you want the links in the email to work. The email uses HTML and will give you a preview of the item uploaded in your email.
string Glob_SMTPServer = "your info here ";
string Glob_SMTPusername = "your info here ";
string Glob_SMTPPassword = "your info here ";
string Glob_SMTPAdminFromEmail = "your info here "; //'"
System.Net.NetworkCredential MyAuthenticationInfo = new System.Net.NetworkCredential(Glob_SMTPusername, Glob_SMTPPassword);
MailAddress emailSender = new MailAddress(Glob_SMTPAdminFromEmail, "Great Maine Pictures");
//if (!IsValidEmail(user.Email))
//{
// return false;
//}
MailAddress emailRecipient = new MailAddress("your info here ", "your info here ");
using (MailMessage mail = new MailMessage(emailSender, emailRecipient))
{
mail.Subject = " New Media Object Added - ";
//mail.Body = Environment.NewLine + Environment.NewLine + "New Media Object Added: " + Environment.NewLine + "http://localhost/gsps/website/Default.aspx?moid=" + mediaObjectId.ToString();
mail.IsBodyHtml = true;
string sBody = "<br /><br />";
sBody = "New Media Object Added: " + "<br />" + Environment.NewLine + "http://localhost/gsps/website/Default.aspx?moid=" + mediaObjectId.ToString() + Environment.NewLine;
sBody = sBody + @"<br /> <a id=""A1"" title=""Image Posted"" href=""http://localhost/gsps/website/Default.aspx?moid=[ID]"" target=""_blank"" style=""display:inline-block;height:64px;width:64px;""><img title=""picture"" src=""http://localhost/gsps/website/gs/handler/getmediaobject.ashx?moid=[ID]&dt=2&g=1"" style=""border-width:0px;""></a><br />""";
sBody = sBody.Replace("[ID]", mediaObjectId.ToString());
mail.Body = sBody;
SmtpClient smtpClient = new SmtpClient();
smtpClient.EnableSsl = false; // gallerySettings.SendEmailUsingSsl;
smtpClient.Host = Glob_SMTPServer;
// Specify port number if it is specified and it's not the default value of 25. The port
// might have been assigned via web.config, so only update this if we have a config setting.
smtpClient.Credentials = MyAuthenticationInfo;
smtpClient.Send(mail);