Ballerina: How do connect with SMTP server and send email? - email

I am looking at WSO2's Ballerina programming language.
I don't see the module or package that allows the ballerina code to call SMTP server and send email.
The only thing close to SMTP is the Gmail connector, but that is not what I am looking for. I expect to write a Ballerina script to chain some services/endpoints but also want to trigger an email by utilizing the company's internal SMTP relay server.
Does anybody have any idea?

You can import email module in ballerina org into your .bal file and send emails.
import ballerina/email;
Please refer to the following documentation depending on your Ballerina version path for email sending capabilities.
[1] Swan Lake Alpha2 - https://ballerina.io/learn/by-example/send-email.html
[2] V1.2.x - https://ballerina.io/1.2/learn/by-example/send-and-receive-emails.html

There is an email standard library for Ballerina to send and receive emails generically using SMTP and POP3/IMAP respectively.
Adding to Suhan's answer, [1] is the API of the email module.
You can also find the unit tests written for the email module (for master branch) in [2].
[1] https://ballerina.io/learn/api-docs/ballerina/#/ballerina/email/latest/email/
[2] https://github.com/ballerina-platform/module-ballerina-email/tree/master/email-ballerina/tests

Related

How to install mail server on vps (digitalocean)

I need send and receive e-mails. I need configure on Digital Ocean Vps a Mail server.
I need a how to or any recommendation about it. I think I will have to create a database to store messages.
I have seen:
Mailgun: I have created an account and created dns records Mx and Txt but Its not verified yet. So I can't receive email.
SendMail: I think it's I have already installed but I don't know how to send and receive email from hello#domain.com
Postfix: I've tried to install didn't work it
Thanks.
Mailservers are complex beasts of software. Installing your own might be a bad idea, unless you're willing to invest time to
make it secure
protect it against spam and viruses
back up your emails
understand topics such as DMARC and TLS and greylisting
...
See why you may not want to run your own mail server for more information.
Maybe you could use an email provider instead? Google Suite is a great choice :)
There's an open-source solution
Mail-in-a-Box lets you become your own mail service provider in a few easy steps. It’s sort of like making your own gmail, but one you control from top to bottom.
Technically, Mail-in-a-Box turns a fresh cloud computer into a working mail server.

Sender dependent relaying on Zimbra 8.7? Can it be done?

I had a server running Zimbra 8.6 and it was configured to send via any one of five external relays based upon which one of my external accounts I was sending from. This worked great until I had a server crash and rebuilt this one using the latest Zimbra 8.7.
I have read and researched and tried everything I had done for my old 8.6 system and I simply cannot get this to work! When I try to send an email from the web client to gmail I get a warning from gmail that my server's IP address and domain are not allowed to relay since they are unauthenticated. According to my postfix configuration I should be authenticating using my own gmail credentials. But, the web client seems to ignore this.
When I try logging in directly on the Zimbra box I can use sendmail with the -tf parameters to mock up an email from one of my addresses to gmail and it works just fine. It is sent and looks like it came from the proper relay domain.
Is sender dependent relaying broken on 8.7? Does it work for anyone?
Welp, I gave up and set my server up to use gmail as the external relay for all accounts, and in my admin console I set my user account to be able to send from all of my external email addresses (specifying each of them there).
Now it properly relays through gmail and still shows each message as coming 'from' the external account I select in the new message window.
Maybe this will help someone with a similar issue.

How to test email notifications of trac in local host ? Especially Mail2Trac plugin and Email2Trac plugin

I'm able to configure SMTP server so that whenever a ticket is created in Trac, the ticket will be sent to the gmail id.
Now the Email to Trac plugin and Mail 2 Trac Plugin works in such a way that, the emails received from the trac system will be replied back and the reply of that mail will be posted automatically as the comment in the ticket.
How to test this plugin functionality in localhost ? I donot know how to setup SMTP server so that I can receive emails generated by trac system inside my machine and I dont have idea how the reverse case (reply to the email) will work locally in my machine.
I'm working in Ubuntu 14.0.4
Guide me on how to do this.
I think smtp_replyto is simply set to an email address, e.g. root#localhost. That's all for the Trac part. Then install an SMTP server on your local machine. Refer to this posting for how to do configure the SMTP server.

AWS SES - Sending Emails

I have created an SES Account and I have verifed my domain - easy as the A record is already with AWS route53. I now need to send emails. Note: I have also created an smtp user account and have the keys.
Question - can I use any (lets say PHP as I like PHP) php script to send emails via SES?
I have found a couple of sites that appear to have scripts for SES like http://www.orderingdisorder.com/aws/ses/ but wanted to ask if now my domain is verified and I have user/keys etc is SES really just an SMTP gateway and I can use any (working) script to send emails via this interface?
thx
You can use their SMTP gateway or send emails via the AWS SDK for PHP programmatically. Just download the SDK, include it in your PHP file and you're good to go.
http://aws.amazon.com/about-aws/whats-new/2011/12/13/amazon-simple-email-service-gets-simpler-with-smtp/
http://docs.aws.amazon.com/AWSSDKforPHP/latest/#i=AmazonSES
http://aws.amazon.com/sdkforphp/

How to send mails from Magento?

I have installed Magento 1.7 on my mac. What should I do to send emails about orders from localhost. I'm developing store localy and just want to check how it works.
Use the tool give on this link Test mail tool
For sending the emails you need SMTP server which listens to port number 25.By default there is no SMTP server with wamp. So you need to use some SMTP tool to check email sending feature in local environment.