We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.email for .net bulksend and mailmerge utilzing Entity Framework

Hello,


could you provide us with a complete example of aspose.email for .net having both “bulk-send and mail-merge” functionality together, but this time utilizing Microsoft’s Entity Framework classes and objects?

Thank you

Hi Luis,


Thank you for writing to Aspose Support team.

The MailMerge functionality of the API works with DataTable and doesn’t support entities as returned by Entitty Framework. Thus, we can’t provide any sample code to use this feature with Entity Frameworks. Please let us know if we can be of any other help to you with respect to your queries related to the API functionality.

Okay… Those are not very good news… But less utilize datasets then…

  1. Would you mind posting an example utilizing strongly typed datasets as oposed to non-typed examples you have posted in your examples?

  2. In order to test I added the line MailMessage msg1 = engine.Merge(confirmationEmailTable[0]); and yet msg1 does not show an htmlbody, it is empty… any ideas?

  3. I am trying with a strongly typed dataset and I don’t get any exceptions or anything and yet nothing gets emailed.

    msg.HtmlBody = emailTemplate.EMAIL_BODY_HTML;

    msg.Headers.Add(“ReferenceNumber”, “#VoterIdNumber”);

    string referenceItemListConstantPortion = “_”;

    VOTER voterEntity = nul;;

    EmailsDset.ConfirmationEmailView_11_23_15DataTable confirmationEmailTable = new EmailsDset.ConfirmationEmailView_11_23_15DataTable();

    EmailsDset.ConfirmationEmailView_11_23_15Row confirmationRow = null;

    foreach (CL_EMAIL_REQUEST_LISTS emailTarget in emailTargetIds)

    {

    voterEntity = a record from the database;

    confirmationRow = confirmationEmailTable.NewConfirmationEmailView_11_23_15Row();

    confirmationRow.VoterIdNumber = voterEntity.IDNUMBER.ToString() + referenceItemListConstantPortion;

    confirmationRow.FirstName = voterEntity.FIRSTNAME;

    confirmationRow.LastName = voterEntity.LASTNAME;

    confirmationRow.EmailAddressTo = voterEntity.EMAIL;

    confirmationEmailTable.AddConfirmationEmailView_11_23_15Row(confirmationRow);

    }

    //confirmationEmailTable.AcceptChanges();

    TemplateEngine engine = new TemplateEngine(msg);

    engine.RegisterRoutine(“GetSignature”, new TemplateRoutine(GetSignature));

    MailMessageCollection messages;

    try

    {

    messages = engine.Instantiate(confirmationEmailTable);

    MailMessage msg1 = engine.Merge(confirmationEmailTable[0]);

    AsposeSingleton.instance.Client.BulkSend(messages);

    }

    catch (MailException mex)

    {

    System.Diagnostics.Debug.WriteLine(mex.ToString());

    }

Hi Luis,


Can you please share a complete sample application to test this issue at our end? We are unable to compile the above sample code. This will help us investigate the issue further at our end and assist you.