Implement Send Email Functionality using Dependency Service





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















Implement Send Email Functionality using Dependency Service.Following fields should be configurable To,Cc,Bcc,Subject and Details.



I tried many examples such as example1 and Example2 and many more. None of that helped.



I'm able to do it in the code behind using Xam.Plugins.Messaging but I need to implement the email service using Dependency service. And I have no clue how to fix this. Any suggestions?










share|improve this question























  • Why can you not stick with the Messaging plugin?

    – Tom
    Jan 3 at 11:30











  • the first link has to do with sending e-mail via SMTP, bypassing the platform native UI. That seems to be very different than what you're asking. It would also help if you explained what specifically you're having problems with.

    – Jason
    Jan 3 at 12:56











  • @Tom I can't stick with Messaging plugin because I want to use dependency injection. Because we can't add cc and attachments also lots of email functionality needs dependency injection.

    – Vegetacoding
    Jan 3 at 13:43











  • @Jason I want a sample working code where the sending email is implemented using dependency injection. And I'm not finding any example related to it.

    – Vegetacoding
    Jan 3 at 13:45






  • 1





    the plugin does support cc and attachments: github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/…

    – Jason
    Jan 3 at 13:57


















-1















Implement Send Email Functionality using Dependency Service.Following fields should be configurable To,Cc,Bcc,Subject and Details.



I tried many examples such as example1 and Example2 and many more. None of that helped.



I'm able to do it in the code behind using Xam.Plugins.Messaging but I need to implement the email service using Dependency service. And I have no clue how to fix this. Any suggestions?










share|improve this question























  • Why can you not stick with the Messaging plugin?

    – Tom
    Jan 3 at 11:30











  • the first link has to do with sending e-mail via SMTP, bypassing the platform native UI. That seems to be very different than what you're asking. It would also help if you explained what specifically you're having problems with.

    – Jason
    Jan 3 at 12:56











  • @Tom I can't stick with Messaging plugin because I want to use dependency injection. Because we can't add cc and attachments also lots of email functionality needs dependency injection.

    – Vegetacoding
    Jan 3 at 13:43











  • @Jason I want a sample working code where the sending email is implemented using dependency injection. And I'm not finding any example related to it.

    – Vegetacoding
    Jan 3 at 13:45






  • 1





    the plugin does support cc and attachments: github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/…

    – Jason
    Jan 3 at 13:57














-1












-1








-1


1






Implement Send Email Functionality using Dependency Service.Following fields should be configurable To,Cc,Bcc,Subject and Details.



I tried many examples such as example1 and Example2 and many more. None of that helped.



I'm able to do it in the code behind using Xam.Plugins.Messaging but I need to implement the email service using Dependency service. And I have no clue how to fix this. Any suggestions?










share|improve this question














Implement Send Email Functionality using Dependency Service.Following fields should be configurable To,Cc,Bcc,Subject and Details.



I tried many examples such as example1 and Example2 and many more. None of that helped.



I'm able to do it in the code behind using Xam.Plugins.Messaging but I need to implement the email service using Dependency service. And I have no clue how to fix this. Any suggestions?







email xamarin dependency-injection xamarin.forms






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 11:23









VegetacodingVegetacoding

3310




3310













  • Why can you not stick with the Messaging plugin?

    – Tom
    Jan 3 at 11:30











  • the first link has to do with sending e-mail via SMTP, bypassing the platform native UI. That seems to be very different than what you're asking. It would also help if you explained what specifically you're having problems with.

    – Jason
    Jan 3 at 12:56











  • @Tom I can't stick with Messaging plugin because I want to use dependency injection. Because we can't add cc and attachments also lots of email functionality needs dependency injection.

    – Vegetacoding
    Jan 3 at 13:43











  • @Jason I want a sample working code where the sending email is implemented using dependency injection. And I'm not finding any example related to it.

    – Vegetacoding
    Jan 3 at 13:45






  • 1





    the plugin does support cc and attachments: github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/…

    – Jason
    Jan 3 at 13:57



















  • Why can you not stick with the Messaging plugin?

    – Tom
    Jan 3 at 11:30











  • the first link has to do with sending e-mail via SMTP, bypassing the platform native UI. That seems to be very different than what you're asking. It would also help if you explained what specifically you're having problems with.

    – Jason
    Jan 3 at 12:56











  • @Tom I can't stick with Messaging plugin because I want to use dependency injection. Because we can't add cc and attachments also lots of email functionality needs dependency injection.

    – Vegetacoding
    Jan 3 at 13:43











  • @Jason I want a sample working code where the sending email is implemented using dependency injection. And I'm not finding any example related to it.

    – Vegetacoding
    Jan 3 at 13:45






  • 1





    the plugin does support cc and attachments: github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/…

    – Jason
    Jan 3 at 13:57

















Why can you not stick with the Messaging plugin?

– Tom
Jan 3 at 11:30





Why can you not stick with the Messaging plugin?

– Tom
Jan 3 at 11:30













the first link has to do with sending e-mail via SMTP, bypassing the platform native UI. That seems to be very different than what you're asking. It would also help if you explained what specifically you're having problems with.

– Jason
Jan 3 at 12:56





the first link has to do with sending e-mail via SMTP, bypassing the platform native UI. That seems to be very different than what you're asking. It would also help if you explained what specifically you're having problems with.

– Jason
Jan 3 at 12:56













@Tom I can't stick with Messaging plugin because I want to use dependency injection. Because we can't add cc and attachments also lots of email functionality needs dependency injection.

– Vegetacoding
Jan 3 at 13:43





@Tom I can't stick with Messaging plugin because I want to use dependency injection. Because we can't add cc and attachments also lots of email functionality needs dependency injection.

– Vegetacoding
Jan 3 at 13:43













@Jason I want a sample working code where the sending email is implemented using dependency injection. And I'm not finding any example related to it.

– Vegetacoding
Jan 3 at 13:45





@Jason I want a sample working code where the sending email is implemented using dependency injection. And I'm not finding any example related to it.

– Vegetacoding
Jan 3 at 13:45




1




1





the plugin does support cc and attachments: github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/…

– Jason
Jan 3 at 13:57





the plugin does support cc and attachments: github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/…

– Jason
Jan 3 at 13:57












1 Answer
1






active

oldest

votes


















0














the API docs include an example of using cc



// Alternatively use EmailBuilder fluent interface to construct more complex e-mail   with multiple recipients, bcc, attachments etc.
var email = new EmailMessageBuilder()
.To("to.plugins@xamarin.com")
.Cc("cc.plugins@xamarin.com")
.Bcc(new { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.Build();

emailMessenger.SendEmail(email);


and Attachments



var email = new EmailMessageBuilder()
.To("to.plugins@xamarin.com")
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.WithAttachment("<path_to_picture>", "image/jpeg");
.Build();





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54021346%2fimplement-send-email-functionality-using-dependency-service%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    the API docs include an example of using cc



    // Alternatively use EmailBuilder fluent interface to construct more complex e-mail   with multiple recipients, bcc, attachments etc.
    var email = new EmailMessageBuilder()
    .To("to.plugins@xamarin.com")
    .Cc("cc.plugins@xamarin.com")
    .Bcc(new { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
    .Subject("Xamarin Messaging Plugin")
    .Body("Well hello there from Xam.Messaging.Plugin")
    .Build();

    emailMessenger.SendEmail(email);


    and Attachments



    var email = new EmailMessageBuilder()
    .To("to.plugins@xamarin.com")
    .Subject("Xamarin Messaging Plugin")
    .Body("Well hello there from Xam.Messaging.Plugin")
    .WithAttachment("<path_to_picture>", "image/jpeg");
    .Build();





    share|improve this answer




























      0














      the API docs include an example of using cc



      // Alternatively use EmailBuilder fluent interface to construct more complex e-mail   with multiple recipients, bcc, attachments etc.
      var email = new EmailMessageBuilder()
      .To("to.plugins@xamarin.com")
      .Cc("cc.plugins@xamarin.com")
      .Bcc(new { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
      .Subject("Xamarin Messaging Plugin")
      .Body("Well hello there from Xam.Messaging.Plugin")
      .Build();

      emailMessenger.SendEmail(email);


      and Attachments



      var email = new EmailMessageBuilder()
      .To("to.plugins@xamarin.com")
      .Subject("Xamarin Messaging Plugin")
      .Body("Well hello there from Xam.Messaging.Plugin")
      .WithAttachment("<path_to_picture>", "image/jpeg");
      .Build();





      share|improve this answer


























        0












        0








        0







        the API docs include an example of using cc



        // Alternatively use EmailBuilder fluent interface to construct more complex e-mail   with multiple recipients, bcc, attachments etc.
        var email = new EmailMessageBuilder()
        .To("to.plugins@xamarin.com")
        .Cc("cc.plugins@xamarin.com")
        .Bcc(new { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
        .Subject("Xamarin Messaging Plugin")
        .Body("Well hello there from Xam.Messaging.Plugin")
        .Build();

        emailMessenger.SendEmail(email);


        and Attachments



        var email = new EmailMessageBuilder()
        .To("to.plugins@xamarin.com")
        .Subject("Xamarin Messaging Plugin")
        .Body("Well hello there from Xam.Messaging.Plugin")
        .WithAttachment("<path_to_picture>", "image/jpeg");
        .Build();





        share|improve this answer













        the API docs include an example of using cc



        // Alternatively use EmailBuilder fluent interface to construct more complex e-mail   with multiple recipients, bcc, attachments etc.
        var email = new EmailMessageBuilder()
        .To("to.plugins@xamarin.com")
        .Cc("cc.plugins@xamarin.com")
        .Bcc(new { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
        .Subject("Xamarin Messaging Plugin")
        .Body("Well hello there from Xam.Messaging.Plugin")
        .Build();

        emailMessenger.SendEmail(email);


        and Attachments



        var email = new EmailMessageBuilder()
        .To("to.plugins@xamarin.com")
        .Subject("Xamarin Messaging Plugin")
        .Body("Well hello there from Xam.Messaging.Plugin")
        .WithAttachment("<path_to_picture>", "image/jpeg");
        .Build();






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 4 at 15:56









        JasonJason

        52.9k1293120




        52.9k1293120
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54021346%2fimplement-send-email-functionality-using-dependency-service%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

            ts Property 'filter' does not exist on type '{}'

            mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window