Sending email using marklogic and xdmp - xquery

I went through product library and found that there is a method called xdmp:email($node) which can send email only using a thing called smtp relay(?) which does NOT require any authentication. How can I send email using my email for example with following configuration:
outgoing smtp server: smtp.gmail.com
smtp port: 465
username: username#gmail.com
password: ****
Use secure connection: true.
This set of parameters are common when we automate the 'send email' process. Now, in marklogic, we have a method named xdmp:email which doesnot provide any place to specify these parameters. So how can we send email in marklogic ?

Set up a local smtp relay that only listens to local connections and does not require a login, but acts as an authentication relay for a smarter host. In your example the smarter host might be google.
For example if you want to use postfix as your authentication relay, you might be able to follow the instructions at http://www.postfix.org/SOHO_README.html under "Enabling SASL authentication in the Postfix SMTP/LMTP client".

Related

Sending Emails With Swift Mailer on Google Cloud using the Mailgun Service Provider

I have a Symfony 3.4 app and FOSUserBundle installed with it. I deployed the app to Compute Engine instance. However, when I try to send emails after each registration, I get the following error.
Exception occurred while flushing email queue: Connection could not be
established
with host smtp.mailgun.org [Connection timed out #110] [] []
Here is my parameters.yml file
parameters:
mailer_transport: smtp
mailer_host: smtp.mailgun.org
mailer_user: postmaster#mydomain.tdl
mailer_password: mailerpass
I also tried
mailer_host: smtp.mailgun.org:587
I added the 587 outgoing port to the firewall rules list on the Google Cloud platform, but that did not help either.
Looks like on Compute Engine you should use port 2525 because outbound connections on ports 25, 465, and 587 is not allowed. You can read more on Mailgun documentation and Google Cloud Platform documentation and more.
Google Compute Engine has all standard outgoing SMTP ports blocked by design. Please vote here to get Google's SMTP behavior changed:
https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/10079937-send-and-receive-email-using-tcp-smtp-imap-ports
Until they open the SMTP ports, there will be no good way to send email from their cloud servers. Sendgrid and the others are too expensive and lack many features that are needed.

How to prevent mail from Wordpress website from being flagged as spam on Exchange online server

I have a website; let's call it abc.com. It's e-mail is handled by Office365. I recently migrated it from a Sharepoint environment to a different webhost (GoDaddy). I have tried using the WP Mail SMTP plugin option to send e-mails, but it fails to send.
My settings are:
smtp: smtp.office365.com
port: 587
encryption: use TLS
authentication: use smtp
Sending fails with the error:
SMTP ERROR: Failed to connect to server: Connection refused (111)
Using the default wp mail with the settings below works to send to e-mail addresses outside the domain, but messages get flagged as spam on addresses within the domain.
header = 'From: '.get_option('blogname').' <wordpress#abc.com>'
I have e-mail routing set to Remote Mail Exchanger. I've tried adding the address wordpress#abc.com to Exchange's allowed list/whitelist, and I even tried adding the host IP to trusted IPs on the server - but it still doesn't work.
As far as I'm aware, GoDaddy do not let you send mail to external SMTP providers. If you're not able to choose another host (which I'd recommend if you can!), you'll need to use wp mail and send all mail to a local address at the same domain, hosted with GoDaddy.
If you wanted to, you could then set up an alias to send it elsewhere.
There's some more background on this over at wordpress.org, such as this thread and this thread.
EDIT
Just realised that the Postman SMTP plugin claims it can get around GoDaddy's filtering using HTTPS:
"Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as Postman can deliver via HTTPS if it can't use SMTP."
So maybe give that plugin a go instead. :)
I ended up using the default wp mail.On the client o365 admin I added the email address to the whitelist. Made the mail rule priority over the default spam filter rule.I even went a step further to whitelist the IP but that's overkill I think.

Google Apps SMTP issue on 1and1

I am at my wits end here. I'm trying to set up SMTP settings for use in Wordpress plugin Contact Form 7. My email server is set up through Google Apps and my website is hosted on 1and1. I am using WP plugin Configure SMTP to set it up. After I try to send test email, I get the following error:
SMTP Error: Could not connect to SMTP host.
My SMTP settings are:
SMTP host: smtp.gmail.com
SMTP port: 465
Secure connection: SSL
Auth: yes
SMTP username: my-username#my-domain.com
SMTP password: password
Sender email: my-username#my-domain.com
I have also tried port 587 on TLS and port 25. I have called 1and1 two times, both times they said they don't block ports and cannot help me since my email is pointed to Gmail. I have tried other WP plugins to set up the SMTP settings. I have doublechecked that the MX records that Google supplied me correct in my 1and1 DNS. I have no idea what else I can do, I have read that other have a similar problem with this set up and with others, yet I have not found anything that has solved my issue. Many are saying it is the webhost that is blocking the ports yet 1and1 said both times I called that they don't block ports and it is a Gmail problem. I don't know what else to try.
Any help would be appreciated.
They are not being honest they do block SMTP ports 465 and 587
If you have Domain hosted at 1and1 and configure an email address they miay say they do block..
I have wordpress site attempting to use Contact for 7 and POSTMAN SMTP plugins
Postman has diag routine, it clearly shows that 1and1 are blocking the only mail port open is 443.

How to send Email through ASP.net using localhost

I am creating a banking application in asp.net v 2.0.I need to send confirmation email when a user creates the new account.
I am running the application in localhost.DO I need any special rights to send SMTP email?
provide me a proper way to send email from my application.
Regards
Jeyaganesh
Do you have a SMTP server set up on localhost? Test by using telnet on the server:
telnet 127.0.0.1 25
If the server responds, try sending raw SMTP commands to send an email and trouble-shoot from there.
I find the easiest way with the Microsoft SMTP server is to disable any checks for authentication and rely on relay restrictions, then restrict relaying to 127.0.0.1.
The fact that you're running on localhost shouldn't make any difference.
As long as you have valid email server settings, and it's allowed on the system you are running on, this works just fine.
Did you try it? Did you have a problem?
I think you can sent by gmail smtp server. check this out
http://csharpdotnetfreak.blogspot.com/2009/08/send-email-using-gmail-in-aspnet.html

Postfix and sending incoming emails to script instead of sending

I want to use Postfix to accept incoming emails and have it send them to an external Python script which parse them and add them to a database.
I read that this could be done via a Policy file.
My first question is what should the policy file return to have Postfix delete the email from the queue with a success message to the sender.
My second question is can I use the Policy file to validate the SMTP authentication that was sent by the client? If not, is there any way of having it use an external script to validate the login?
Thanks!
Christian
If you need SMTP authentication anyway and just want a script to act as MDA, I think you can do it simply by
setting mailbox_command = /path/to/my/script in /etc/postfix/main.cf and configuring an authentication scheme. If you have dovecot running, too, I can recommend having postfix authenticate via dovecot, which is very configurable when it comes to SASL authentication.
Update
Since you will be having plaintext passwords going over the wire (assuming this service is reachable from the network), I recommend permitting authentication only over an encrypted line. The configuration I'm going to show will still accept mails for which the server is the destination without authentication. As far as I know, that behaviour is mandated by an RFC for SMTP servers which are reachable from the internet.
Announce SASL authentication only over encrypted connections
smtpd_tls_auth_only=yes
Don't require everyone to talk to you over an encrypted channel
smtpd_tls_security_level=may
SASL boilerplate
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain = $mydomain
For whom to accept mail. This is worked left to right, until a permitting or denying rule is encountered. Fallback behaviour would be to permit.
smtpd_recipient_restrictions = permit_auth_destination, reject_plaintext_session, permit_sasl_authenticated, reject
permit_auth_destination as first rule would make sure that clients may deliver mail to users for which I feel responsible unauthenticated. The clients may choose whether to use TLS or not.
reject_plaintext_session as second rule makes sure that all other rules further down the line can assume an ecrypted channel.
permit_sasl_authenticated is self-explanatory
reject as last rule basically changes the default policy to "deny".
If you don't want to accept mails without SMTP authentication, you may want to drop the first rule of smtpd_recipient_restrictions.
Not shown is the configuration of the SSL certificate and how to tell postfix about it (the latter of which is easy).

Resources