ant mail task : Limitation on addresses with dot on either sides - email

My ant script based on the mail task works fine with mail addresses of the form A#B.C where A,B, and C are strings NOT containing dots, '.' .
Alas, I need it to work with addresses of the form:
A.D#B.C and A#E.B.C
which are in common use today.
<mail mailhost="x.com" mailport="587" tolist="mail#y.z.com" subject="? was updated.">
<from address="mail#cvkimball.com"/>
</mail>
Is this a limitation of the ant mail task?

I failed to provide the SMTP server's user and password attributes.
Since I was testing with an e-mail dress on the same server, the server (apparently) didn't check the user and password and my test succeded.

Related

Sitecore custom MTA for localhost

I am trying to figure out EXM for Sitecore. I installed it and now I am trying to configure it to send emails from my local machine. SAC MTA is not an option because I don't have access to App Center. I am left with custom MTA.
I was trying to configure config files to use gmail smtp:
Sitecore.EDS.Providers.CustomSmtp.config
<smtpSettings type="Sitecore.EDS.Core.Net.Smtp.SmtpSettings, Sitecore.EDS.Core" singleInstance="true">
<server>smtp.gmail.com</server>
<port>465</port>
<userName>*****#gmail.com</userName>
<password>*****</password>
<authenticationMethod>Login</authenticationMethod>
<startTls>true</startTls>
<proxySettings ref="exm/eds/proxySettings" />
</smtpSettings>
Sitecore.EDS.Providers.CustomSmtp.Sync.config
<pop3Settings>
<pop3Setting type="Sitecore.EDS.Core.Net.Pop3.Pop3Settings, Sitecore.EDS.Core" singleInstance="true">
<server>pop.gmail.com</server>
<port>995</port>
<userName>****#gmail.com</userName>
<password>****</password>
<useSsl>true</useSsl>
<startTls>true</startTls>
<proxySettings ref="exm/eds/proxySettings"/>
</pop3Setting>
</pop3Settings>
But when I try to "send quick test" through EXM I get "Failed to connect to the email server. Please try again later". Can anyone help me with that configuration. And is it even possible? I remember reading something about paid license to use custom MTA. Would it mean, that you need to pay to send email via EXM?
To switch from using the Sitecore MTA to using the Custom SMTP, you must disable the Dyn configurations and then enable the CustomSmtp configurations:
In the Website\App_Config\Include\EmailExperience folder, add the suffix .disabled to the end of the following file names:
Sitecore.EDS.Providers.Dyn.config
Sitecore.EDS.Providers.Dyn.Sync.config
In the  Website\App_Config\Include\EmailExperience folder, remove the suffix .disabled from the following file names:
Sitecore.EDS.Providers.CustomSmtp.config.disabled
Sitecore.EDS.Providers.CustomSmtp.Sync.config.disabled

Unrecognised attribute 'enableSsl' in .NET v4.0

We've been running a new system in test for a while now and creating emails to a folder so they don't accidentally go out to clients. Now we've turned on live emailing we are getting issues with sending.
I'm using ActionMailer.NET and the code to create and send the email is below. I won't include the View:
EmailResult x = new EmailController().EmailWorkOrderForApprovalToClient(model);
System.Net.Mail.Attachment file = new System.Net.Mail.Attachment(FilePath);
x.Mail.Attachments.Add(file);
x.Deliver();
Which gives the error
The SMTP server requires a secure connection or the client was not
authenticated. The server response was: 5.7.57 SMTP; Client was not
authenticated to send anonymous mail during MAIL FROM
The web.config looks like this:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="ClientServices#topupconsultants.com">
<specifiedPickupDirectory pickupDirectoryLocation="" />
<network defaultCredentials="false" host="smtp.office365.com" password="secret" port="587" userName="ClientServices#myco.com" />
</smtp>
</mailSettings>
My assumption is that enableSsl="true" needs to be added to the network line, but when I do that and try to go to the SMTP Email section of the site in IIS, I get the error:
Unrecognized attribute 'enableSsl'
I'm not that hot on IIS, but I've checked that the Application Pool and its .NET CLR version is 4.0.30319. I've also checked that .NET v4.5 is installed on the server.
This is baffling me, and I'm hoping I don't have to totally change my code to a method that allows me to specify SSL at that point.
Answering my own question here, and basically the answer is: "Don't believe the error message". In all the configurations I tried, I believed the error message when it told me that is was unacceptable. However, I tried it anyway, and it uses the enableSsl attribute when it sends, and this allows the connection to Office 365 to succeed.
Slightly irritating IIS bug that I'll forget about in a week, but right now is very annoying.
This is issue on IIS no need to worry about this error message
SmtpClient object enableSsl value get mapped
this silly issue is wasted my much time :D

How to send an email with Ansible

I'm trying to send an email using Ansible, but I can't understand how it works as I don't know how to provide user and password for such service (not specified in the documentation).
Both my machine and the email server are in the same network, but I need to be authenticated in order to send the email.
This is my yml file:
---
- name: Testing email
hosts: localhost
tasks:
- name: Send email
local_action: mail
host=mail.server.com
port=993
subject="Ansible test mail"
body="Testing email"
from=my#email
to="y#email
charset=utf8
And this is the related content of the hosts' file:
[localhost]
localhost ansible_connection=local
Any idea about how should I configure it? Thanks in advance.
Looking at the source code for the mail module ( https://github.com/ansible/ansible/blob/d1effecb2ef073e478c67a7ca39cf56708a66a48/library/notification/mail ) it doesn't look like it supports SMTP authentication.
It shouldn't be too hard to add support for it however. It would require adding the username and password parameters to the module, detecting if they've both been supplied, and if so, calling smtp.login() with those parameters.
In fact, it looks like there's two pull requests to do exactly that at the moment here
https://github.com/ansible/ansible/pull/7213
and here
https://github.com/ansible/ansible/pull/6667
So support will most likely be added in dev soon.

Debian - invoke external script from exim on receipt of emails

I am looking fopointers on the best approach to process incoming emails to a certain vhost and to call an external script with the email data as parameters - basically to allow email to be sent to a certain "private" email address at a host which then auto inserts something into that sites database. I currently have exim set up as the mail handler.
You have to follow exim single file configurations structure. In routers section write your own custom router that will deliver email to your desired php script. In transport section write your own custom transport that will ensure delivery to the desired script using curl. Just write the following configurations in your /etc/exim.cnf file:
############ROUTERS
runscript:
driver = accept
transport = run_script
unseen
no_expn
no_verify
############TRANSPORT
run_script:
debug_print = "T: run_script for $local_part#$domain"
driver = pipe
command = /home/bin/curl http://my.domain.com/mailTest.php --data-urlencode $original_local_part#$original_domain
Where mailTest.php will be your destined script.
Procmail is a good generic answer. If your needs are very specific, you could hook in your own script directly from your .forward (or Exim's corresponding construct -- can't remember exactly how it differs), but oftentimes, wrapping your own script inside a simple .procmailrc helps you avoid a bunch of iffy details of email delivery, and concentrate on the actual processing.
:0
' ^Subject: secretpassword adduser \/[A-Z]+
| echo "insert $MATCH into users" | mysql -d users

How to use Ant mail task? what are the manditory inputs?

I am using ms- outlook. What are the manditory inputs for this Ant task and how can i find my mailhost and mailport number?
According to the Ant's Mail task documentation, the following information is required:
from attribute or <from> nested element.
tolist, cclist, or bcclist attributes or their equivalent nested elements <to>, <cc>, or <bcc>.
either message or messagefile attribute, alternatively nested <message> element.
If you SMTP server requires authentication, you must provide user and password attributes.
Basically these are required for any mail client.
Mail host and port, the address of an SMTP server, you can get from your system administrator.