ASP Classic CDOSYS - asp-classic

We are having issues sending an XML file via email using CDOSYS. The problem (we suspect) is too many headers on the outgoing email.
Our old emailer (SMTP Mailer) had the following setting "UseMSMailHeaders" set to false which resulted in minimal headers on the outgoing mail. We are looking to add this same setting to the CDOSYS to achieve the same minimal headers - however there is no such configuration setting for CDOSYS.
The working email headers (created using SMTP Mailer) were as follows:
X-mailer: Asp Component Bundle 4.03 (COMB63E607)
Content-Type: text/xml; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
The email headers (created using CDOSYS) are now:
X-Originating-IP: [82.11.130.88]
X-Spam: 0
X-Authority: v=2.1 cv=Rs1LLUWK c=1 sm=1 tr=0 a=NcIbe7jg/PruPBS/SkG5Ow==:117
a=NcIbe7jg/PruPBS/SkG5Ow==:17 a=OZ8DCac85m8A:10 a=uObrxnre4hsA:10
a=NLZqzBF-AAAA:8 a=KQ9VrMxVm9wA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=9iDbn-4jx3cA:10
a=cKsnjEOsciEA:10 a=WzHNiX6cKY2DZ1D7HSYA:9 a=SSmOFEACAAAA:8 a=e0m2sKwKAAAA:8
a=LDuhtmgyDqFV3yBKdvUA:9 a=wVYsaH73nbqcsVgb:21 a=p8LqAaNAe91_BBSR:21
a=zJJgJrR4LD4A:10 a=ZHtQ2jxvbGEA:10 a=JiXicNB2fugA:10
X-Priority: 1
X-MSMail-Priority: Normal
thread-index: Ac8vaWtRWKRVMRvtReSO2cdupviJVQ==
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0009_01CF2F69.6B518590"
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.17609
I notice that the CDOSYS email Content-Type is set to "multipart/mixed" even though our ASP code has the following line:
Set Mailer = CreateObject("CDO.Message")
Mailer.Configuration.Fields.Item (http://schemas.microsoft.com/cdo/configuration/content-type") = "text/xml"
Is this normal behaviour?
Thank you for any help.

What exactly is too many headers? A good mail transport agent (MTA) should provide detailed headers. Maybe what you mean to ask is something along the lines of: I changed how I build and transmit my SMTP messages and now they all bounce. Is something like that happening? If not, try to elaborate on the details of the nature of the true underlying problem further.
As for the second part of your message, if you attach a file, the content type will change automatically.

Related

How to set hostname used in JavaMail or Apache James Message-Id header?

I am having issues with mail bouncing when sending from my own server to my own active yahoo account using JavaMail. The mails are passing SPF, DKIM and DMARC according to google mail that receives the same messages being bounced by yahoo. I can send messages from other accounts to my yahoo account without issue.
The messages send fine from my server to ZMail, GMail, Microsoft mail. Looking at the emails, the only thing that I have noticed is the message header for the Message-Id. My messages have the following header:
Message-ID: <923936395.17.1634776639078#[internally visible hostname]>
I am wondering if this header could be the problem and whether there is a way in JavaMail or in the Apache James to set the hostname or IP address that gets used in this message so that rather than using the "internally visible hostname", I can get the hostname that is externally visible. I have been searching the available documentation for Apache James and JavaMail but have not found any parameters to try in order to resolve this.
According to the Decompiled SRC of sun mail it should be possible by setting some properties for your session.
props.setProperty("mail.from", user);
props.setProperty("mail.host", host);
//props.setProperty("mail.user", user);
The Id will be updated by the save method (saveChanges()) and will trigger an new ID generation (updateHeaders() -> updateMessageID()). (Looked up in the decompiled MimeMessage.class)
Leading to the HostPart called in javax.mail.internet.InternetAddress.
The relevant method is _getLocalAddress.
Here you can see that the values get extracted from the Properties or will fallback to your local machine.
Used Fields:
user.name
mail.from
mail.user
mail.host
The user.name property can also be looked up from the system props.

Wrong S3 Authentication with Paw App

End device: EMC ECS,
Protocol: AWS S3
I'm trying to authenticate with my Python script and construct the same request using Paw.
Python with boto works just fine.
The primitive code:
from boto.s3.connection import S3Connection
accessKeyId = 'objuser'
secretKey = 'spl4vDHl11H7uW/683WZCoYrle03Bn1hd42gy8bd'
host = '10.10.10.10'
port = 9020
conn = S3Connection(aws_access_key_id=accessKeyId,
aws_secret_access_key=secretKey,
host=host,
port=port,
calling_format='boto.s3.connection.ProtocolIndependentOrdinaryCallingFormat',
is_secure=False)
print conn.get_all_buckets()
Correct headers are accepted by the S3 server
Date: Fri, 08 Apr 2016 07:38:34 GMT
Authorisation: AWS obtuser:Gi/qcdbyYcVMdI9EkdORPMx2wbo=
Next I re-create the same request with Paw but get wrong headers:
Date: Fri, 08 Apr 2016 07:38:34 GMT
Authorisation: AWS obtuser:/znFNFviqD5fw3t1oWUwBQ8B5M4=
Of course it is rejected by the S3 server.
In Paw I use Authorisation header with standard "S3 Amazon S3 Authorisation Header" dynamic value. AWS Access Key ID and Secret Access key ID are the same as in the script (triple checked).
According to the ECS documentation, S3 Authentication follows Signing and Authenticating REST Requests So signature is based on the standard HMAC-SHA1.
I expect that the same method is used by Paw.
Could you please advice what is potential reason why Paw doesn't create correct Authorisation header and how to fix that?
Many thanks in advance !
Sorry for the very late answer! I've just tested this again myself, using our AWS account, and for example, I've been able to list all our S3 buckets easily, see this screenshot:
It seems like it's probably an issue related to the way the Authorization header has been configured, or an invalid character being inserted in the URL field. (A screenshot would help to see what can be wrong)
Using Paw v3.0.16 and "Amazon S3 Authorisation Header" dynamic value, SignatureDoesNotMatch error occurred with this URL.
GET https://s3-ap-northeast-1.amazonaws.com/bucket123/sub456/some789.json
And it works well with this URL.
GET https://bucket123.s3.amazonaws.com/sub456/some789.json
http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html

Sending email using Gmail SMTP - Meteorjs

Hi I am trying set up my gmail account to send email for my Meteor app, not very easy so far
server.js
Meteor.startup(function () {
smtp = {
username: 'xxxxx', // eg: server#gentlenode.com
password: 'YYYYYYYY', // eg: 3eeP1gtizk5eziohfervU
server: 'smtp.gmail.com', // eg: mail.gandi.net
port: 465
}
process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username) + ':' + encodeURIComponent(smtp.password) + '#' + encodeURIComponent(smtp.server) + ':' + smtp.port;
});
Email.send({
from: "meteor.email.2014#gmail.com",
to: "xxxx#gmail.com",
subject: "Meteor Can Send Emails via Gmail",
text: "Its pretty easy to send emails via gmail."
});
And the testing email is never sent with the below error code saying that I havent set the environment variable.
I20150715-18:14:02.641(0)? ====== BEGIN MAIL #0 ======
I20150715-18:14:02.642(0)? (Mail not sent; to enable sending, set the MAIL_URL environment variable.)
I20150715-18:14:02.643(0)? MIME-Version: 1.0
I20150715-18:14:02.643(0)? From: meteor.email.2014#gmail.com
I20150715-18:14:02.643(0)? To: xxxx#gmail.com
I20150715-18:14:02.643(0)? Subject: Meteor Can Send Emails via Gmail
I20150715-18:14:02.643(0)? Content-Type: text/plain; charset=utf-8
I20150715-18:14:02.643(0)? Content-Transfer-Encoding: quoted-printable
I20150715-18:14:02.644(0)?
I20150715-18:14:02.644(0)? Its pretty easy to send emails via gmail.
I20150715-18:14:02.645(0)? ====== END MAIL #0 ======
Could this be due I am running this on C9?
Thanks
Sucks that cloud9 does not permit the setting of environment variables. Perhaps you can set the Meteor.settings object rather than an environment variable?
http://docs.meteor.com/#/full/meteor_settings
Essentially, you can pass JSON to meteor when you start it using --settings. These will be available on the server side only, unless wrapped under a "public" object of the root.
{
'public': {
'some-setting': 'some-value'
},
'other-setting': 'other-value'
}
That is a work around for dealing with no envrionmental variables. As the core email package always looks at the MAIL_URL environmental variable, you will probably need to send email through another service/provider.
Mandrill (by Mailchimp) have a sizeable free tier and will allow you to send transactional email. You can even make a mail template in mailchimp, export to HTML, import to mandrill and pass in merge variables in your API calls.
Better yet, there is a kick-ass package for writing to the Mandrill API. https://atmospherejs.com/wylio/mandrill
Hope that helps!
Elliott
but decided to answer my own question anyway.
I didnt and I cant set the C9 or my testing site env variable, so that s why.
The Meteor.startup(callback) method is executed at the end of Meteor initialization, but you are sending your email before the startup, so you should send it in the same block, after process.env.MAIL_URL..
You CAN set environmental variables using C9! You just pass it in when you run meteor.
BUT you can not send email using SMTP though on c9!
To make my life easier I just don't test my emails on c9 with Meteor.
If I absolutely need to I bypass the email function and use a custom emailer instead that sends using the MailGun REST API (NOT SMTP!!)
See Sending email using Gmail SMTP - Meteorjs

DKIM signing emails using Postfix with removed headers

I have a problem getting OpenDKIM working with Postfix. Due to security reasons we remove certain headers from our emails:
From main.cf:
mime_header_checks = regexp:/etc/postfix/header_checks
header_checks = regexp:/etc/postfix/header_checks
The headers removed are as follows:
/^Received:.*with ESMTPSA/ IGNORE
/^X-Originating-IP:/ IGNORE
/^X-Mailer:/ IGNORE
/^Mime-Version:/ IGNORE
However this makes the opendkim fail:
Nov 22 19:26:15 localhost opendkim[5104]: BC4F5406A9: can't determine message sender; accepting
Is there any way to have the headers removed and getting opendkim work?
Found a solution here. Instead of removing the header that caused the problem we simply rewrite the IP address:
https://we.riseup.net/debian/mail#getting-your-postfix-anonymized
My solution to the same problem was to add the "Reply-To: " field. Apparently OpenDKIM is using this when the "Received: " part is missing.
Note that Outlook didn't add by default, I had to set it in mailbox settings.

Symfony2.1: email sent in HTML format seems to be escaped

In my Symfony2.1 application I'm using the SwiftMailer to send emails. Since I'm in dev mode, I'm not sending emails for reals. I control the output in the toolbar provided by the Profiler.
The email I'm sending is in HTML. So, to ensure HTML output I did the following settings:
$message = \Swift_Message::newInstance()
->setContentType("text/html")
->setSubject('Conferma registrazione nuovo utente')
->setFrom('xxx#xxx.com')
->setTo($email)
->setBody($this->renderView('AcmeMessageBundle:Contact:contact_request_email.html.twig', 'text/html');
$this->get('mailer')->send($message);
I suppose all the setting for HTML emails are ok. Notwithstanding that, I see that the emails sent are not shown as HTML in the Profiler dedicated area. In particular, all the HTML tags are escaped! Why? What am I missing in the settings?
For dev it is recommended to set up something like Gmail to deal with emails
# app/config/config_dev.yml
swiftmailer:
transport: gmail
username: your_gmail_username
password: your_gmail_password
As for HTML emails, I can't tell exactly what's your problem, it could be anything. HTML emails are not easy (it's like developing for IE6), that's why a lot of devs just choose to send text emails.

Resources