Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: MailGun API Code?



Permlink Replies: 11 - Last Post: Jan 15, 2018 12:36 PM Last Post By: Daniel Fields Threads: [ Previous | Next ]
Daniel Fields

Posts: 622
Registered: 11/29/04
MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 2:27 AM
Has anyone every used the MailGunAPI through Delphi?

I need to translate this into Delphi. I'm guessing that it could use TidHTTP, but I'm not sure about the authorization parameters.

curl -s --user 'api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0' \
    https://api.mailgun.net/v3/samples.mailgun.org/messages \
    -F from='Excited User <excited@samples.mailgun.org>' \
    -F to='devs@mailgun.net' \
    -F subject='Hello' \
    -F text='Testing some Mailgun awesomeness!'
Eitan Arbel

Posts: 508
Registered: 2/24/13
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 6:06 AM   in response to: Daniel Fields in response to: Daniel Fields
Hi Daniel

i use it like it was just a regular SMTP server.
i use only IdSMTP and IdMessage.

i use IdSMTP.host:="smtp.mailgun.org".

once you set your domain, you should see 2 Active domains : one is the domain you set and want to use, and the other one is a SandBox "domain".

Click your domain from that list, and then click "Manage SMTP credentials" from the "Default Password" section.
you will move to a page called "SMTP Credentials For ..." (for your domain)
there you can add and see the list of email addresses you have, that you can use to send mails.

just don't forget to set the mxa, mxb,TXT CNAME etc' of your DNS record.
(it took me some time to understand what they want from me, but once there, it went smoothly...)
Eitan Arbel

Posts: 508
Registered: 2/24/13
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 6:07 AM   in response to: Daniel Fields in response to: Daniel Fields
Hi Daniel

i use it like it was just a regular SMTP server.
i use only IdSMTP and IdMessage.

i use IdSMTP.host:="smtp.mailgun.org".

once you set your domain, you should see 2 Active domains : one is the domain you set and want to use, and the other one is a SandBox "domain".

Click your domain from that list, and then click "Manage SMTP credentials" from the "Default Password" section.
you will move to a page called "SMTP Credentials For ..." (for your domain)
there you can add and see the list of email addresses you have, that you can use to send mails.

just don't forget to set the mxa, mxb,TXT CNAME etc' of your DNS record.
(it took me some time to understand what they want from me, but once there, it went smoothly...)
Eitan Arbel

Posts: 508
Registered: 2/24/13
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 6:08 AM   in response to: Eitan Arbel in response to: Eitan Arbel
that stupid embarcadero forum is going crazy again...
Jose Nilton Pace


Posts: 122
Registered: 5/15/98
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 10:33 AM   in response to: Daniel Fields in response to: Daniel Fields
Hi Daniel, if your delphi is Seattle+, you can use new components RestClient, RestRequest, RestResponse and HttpBasicAuthenticator to do this.
Daniel Fields

Posts: 622
Registered: 11/29/04
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 9, 2018 11:53 AM   in response to: Daniel Fields in response to: Daniel Fields
Wow, I did not expect to get answers to both methods! I want to try both methods. The SMTP interests me because I've used that method before. I'm new to MailGun, so the directions to configure the SMTP are very useful.

I'm interested in the API using the REST components because it will help me interface with other APIs. I have never used them.

Thanks for the help guys!

Sorry, I didn't mean to post so many times, but the error said the post had failed.
Jose Nilton Pace


Posts: 122
Registered: 5/15/98
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2018 8:06 AM   in response to: Daniel Fields in response to: Daniel Fields
Hi Daniel, I'm teaching you something, LOL. I'm very happy to announce we made a simple demo, enjoy and please, tell me you have any doubt.
https://github.com/Atozed/IntraWeb/tree/master/XIV/Delphi/MailGun
Lou Feliz

Posts: 114
Registered: 7/16/97
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 12, 2018 9:00 AM   in response to: Jose Nilton Pace in response to: Jose Nilton Pace
Cool thanks for sharing this.
Jose Nilton Pace wrote:
Hi Daniel, I'm teaching you something, LOL. I'm very happy to announce we made a simple demo, enjoy and please, tell me you have any doubt.
https://github.com/Atozed/IntraWeb/tree/master/XIV/Delphi/MailGun
Dan Barclay

Posts: 889
Registered: 11/9/03
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 12, 2018 11:35 AM   in response to: Jose Nilton Pace in response to: Jose Nilton Pace
Jose Nilton Pace wrote:
Hi Daniel, I'm teaching you something, LOL. I'm very happy to announce we made a simple demo, enjoy and please, tell me you have any doubt.
https://github.com/Atozed/IntraWeb/tree/master/XIV/Delphi/MailGun

This sample apparently requires the REST in Seattle as you've described above. I haven't run into any of the other demo/sample projects that are Delphi version specific (though there may be some).

Is there a way to note this requirement in the repository? Maybe this demo is a REST demo rather than an IW demo (even though IW is used)?

Thanks,
Dan
Jose Nilton Pace


Posts: 122
Registered: 5/15/98
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2018 11:16 AM   in response to: Dan Barclay in response to: Dan Barclay
Hi Dan, thank you for your suggestion.
I created 2 demos now, one using Rest for the delphi that have the Rest components and another using Indy for delphi that doesn't have the Rest components.
https://github.com/Atozed/IntraWeb/tree/master/XIV/Delphi/Mailgun

Daniel, now we have 3 options, LOL.
Dan Barclay

Posts: 889
Registered: 11/9/03
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 13, 2018 11:21 AM   in response to: Jose Nilton Pace in response to: Jose Nilton Pace
Jose Nilton Pace wrote:
Hi Dan, thank you for your suggestion.
I created 2 demos now, one using Rest for the delphi that have the Rest components and another using Indy for delphi that doesn't have the Rest components.
https://github.com/Atozed/IntraWeb/tree/master/XIV/Delphi/Mailgun

Daniel, now we have 3 options, LOL.

Sweet <lol>

Dan
Daniel Fields

Posts: 622
Registered: 11/29/04
Re: MailGun API Code?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 15, 2018 12:36 PM   in response to: Daniel Fields in response to: Daniel Fields
Sorry for the delayed response. I've been battling the flu since I posted my question. Jose, I cannot get your link to work, but using the REST Client components was just as easy as you suggested. I got it to work on the first attempt. And it's fast. I've since used those components to access other services.

Thank you for pointing me in the right direction. I certainly don't know everything about Delphi. I try to absorb as much as I can because there is so much to know. I'm a humble man when it comes to learning from others in the field. I'm certain there are more things I can learn from you and others on the forum. That's what I love about the community.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02