Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • stephen 64 posts 105 karma points
    May 13, 2015 @ 16:57
    stephen
    0

    Notifications

    I have an admin email address and notification reply email. When a post is created it requires a moderator to Approve but no email is sent/received.

    Got my smtp settings in the web.config

    Is there something I am missing?

  • Jan Skovgaard 11239 posts 23375 karma points MVP 6x admin c-trib
    May 13, 2015 @ 18:06
    Jan Skovgaard
    0

    Hi Stephen

    What version of Umbraco are you using? And are you certain that the SMTP information entered are correct? Also make sure to see if there are any related error messages in the /app_data/logs file - Make sure to search the whole file for any entries marked with "ERROR" or "WARNING".

    A neat tool for testing if emails are being sent is smtp4dev - https://smtp4dev.codeplex.com/

    Hope this helps.

    /Jan

  • stephen 64 posts 105 karma points
    May 14, 2015 @ 11:16
    stephen
    0

    Umbraco 7.2.0

    smtp is fine cause other forms elsewhere are relaying 

    smtp settings in web.config

    No ERROR or WARNING in the log file 

    (added some try/catch statements)

    The Back Office Forum/Email settings are valid (Admin Email Address & Notification Reply Email Address)

    In CreateNewPost.cshtml it calls

    Action Name - CreatePost

    Controller Name - DialoguePostSurface

    So I checked in the Controller

    The error occurs when trying to call unitOfWork.Commit()

    ###################### ERROR LOG ###################

    2015-05-14 10:11:05,587 [30] ERROR System.Web.IHtmlString - [Thread 14] Dialogue Package: Dialogue Package Exception

    System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details. ---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'PostContent', table 'TurningPointScotland.dbo.DialoguePost'; column does not allow nulls. INSERT fails.

    The statement has been terminated.

       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)

       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)

       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)

       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

       at EFCache.CachingCommand.ExecuteNonQuery()

       at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)

       at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)

       at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)

       at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()

       --- End of inner exception stack trace ---

       at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()

       at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)

       at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)

       at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)

       at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)

       at System.Data.Entity.Internal.InternalContext.SaveChanges()

       --- End of inner exception stack trace ---

       at System.Data.Entity.Internal.InternalContext.SaveChanges()

       at Dialogue.Logic.Data.UnitOfWork.UnitOfWork.Commit()

       at Dialogue.Logic.Controllers.DialoguePostSurfaceController.CreatePost(CreateAjaxPostViewModel post)

    ##################### END OF ERROR LOG ##############

     

     

     

     

     

  • stephen 64 posts 105 karma points
    May 14, 2015 @ 15:27
    stephen
    0

    Managed to resolve this for my requirements but a different approach might be required for others.

    The main issue is in the Controller DialoguePostcontroller.cs

    unitOfWork.Commit() fails so I just wrapped it in a try/catch. 

    the error Cannot insert the value NULL into column 'PostContent', table 'TurningPointScotland.dbo.DialoguePost'; column does not allow nulls is raised so I enabled null. (Maybe I tried to pass an empty val)

    I moved the NotifyNewTopics method cause it justr want't getting called using UnitOfWorkManager.NewUnitOfWork

    The ServiceFactory.EmailService wasn't working for my environment and it was trying to get a list of users to notify but the back office Email tab has "Admin Email Address" (This admin email address is where all notifications will be sent) so there appears to be 2 different processes. Either it should get sent to the Admin Email Address or it should get Users who have been identified as receiving notifications.

    I opted for the Admin Email Address.

    With this, I rewrote the NotifyNewTopics to retrieve the email address and send the appropriate email.

    As the name suggests, "NotifyNewTopics" isn't the same as new posts so I'll probably have to add a new method later but, in the end, it did the job.

     

    This may be of help to others.

Please Sign in or register to post replies

Write your reply to:

Draft