Coldfusion not sending email - email

I am having problems with this website, it isn't sending any emails. Basically when someone places a order, it sends a comfirmation email. I don't see any problems with the code but I believe this is the right place to be looking for the problem. Can some one help me please?
<cfquery name="getUser" datasource="personal2009">
SELECT * FROM site_users WHERE id = '#session.id#'
</cfquery>
<cfoutput>
<cfmail to="#site_email#" from="#site_email#" subject="Website International Order Request">
#getUser.title# #getUser.Firstname# #getUser.Surname# has requested to deliver an order to an international address.
Their contact details are:
#getUser.Address1#
#getUser.Address2#
#getUser.Town#
#getUser.Postcode#
#getUser.Country#
#getUser.Tel#
#getUser.email#
The delivery address requested is:
#formtitle# #formFirstname# #formSurname#
#formAddress1#
#formAddress2#
#formTown#
#formPostcode#
The order details are:
<cfset thisrow = 0><cfoutput><cfset thisrow = thisrow + 1><cfset tot = 0><cfloop index="list" from="1" to="#session.numincart#"><CFQUERY NAME="ind" DATASOURCE="personal2009" maxrows=1>SELECT * FROM products WHERE id = #listgetat(session.cart, list)#</CFQUERY>
Product Name: #ind.product_name#
Price: £#decimalformat(listgetat(session.price, list))#<cfset multiply2 = #listgetat(session.quant, list)#>
Quantity: #listgetat(session.quant, list)#
</cfloop></cfoutput>
Thank you
</cfmail>
</cfoutput>
<cfset session.endemail = '1'>

Depending on what your hosting environment looks like, I may suggest altering your cfmail tag to the following:
<cfmail to="#site_email#" from="#site_email#" subject="Website International Order Request" server="#server#" username="#username#" password="#password#">
1) If you don't have access to the CFADMIN, you are unable to track your mail path. Specifying your own server/username/password will allow you to send email with your own SMTP server and rule that out.
2) Even if your host has CFMAIL setup with a SMTP default server, it may be possible that they have not setup SMTP relaying correctly. The outcome is your mail gets sent through coldfusion but rejected by the smtp server.
3) Even if your host has CFMAIL setup and SMTP relaying setup, the last possibility could be SPAM filters on the receiving end. If you have SPAM filters that look at SPF/Domain Keys/other criteria, they could be blocking to emails too.
Specifying your own server/username/password is usually the best bet to troubleshooting email issues.

Related

How to change recipient of a VACATION autoresponder mail to one in sender's mail header section [Reply-to] purely in Sieve Language?

I need to set an autoresponder that will send a message like "We got You mail! We will get back to you ASAP". The problem is that the sender of customer email is not customer itself (i.e. customer#privatemail.com), but some global mail (i.e. customerservice#marketplace.com) that contains customer private mail in the header section [Reply-to].
This is a hosted server with installed RoundCube. I can only use Sieve filters to create an autoresponder.
rule:[Autoresponder]
if allof (
header :contains "from" "#marketplace.pl",
{
vacation text:
We got You mail! We will get back to you ASAP!
.
;
}
I need to read the value of the header [Reply-To] section, set the recipient of autoresponder mail to that value and send a VACATION message. Only in Sieve language.

SpamAssassin rule doesn't catch "Returned mail: see transcript for details"

I'm getting hundreds/thousands of emails on my catch all address for my domain, with the subject "Returned mail: see transcript for details".
I am trying to catch these emails with spam assassin (SA) to mark them as spam, but the SA rule only works if I email a test email to my domain with that text in the subject. The actual spam mails are not marked... only the once I send myself as a test.
I have tried (in local.cf):
header LOCAL_SUBJECT_RETURNED_MAIL Subject =~ m/Returned mail/i
score LOCAL_SUBJECT_RETURNED_MAIL 10.0
header LOCAL_SUBJECT_RETURNED Subject =~ /\bReturned\b/i
score LOCAL_SUBJECT_RETURNED 10.0
Again... the rules are working, yet it looks like the spam emails come in without being scanned by spam assassin.
Does anyone have any idea on what I could try?
Things I've tried/done
I enabled php mail logging on my system, to ensure it's not being send through a script on my domain. Log is empty, so that's good.
The reason why spamassassin is not catching these emails (backscatter), is because they don't come through spamassasin, because they come from the mailer deamon inside my domain/webserver.
Test mail I send myself:
Received: from localhost by server.myprovider.net
with SpamAssassin (version 3.2.4);
Backscatter spam:
Return-Path:
Received: from localhost (localhost)
As you can see, it doesn't come through spamassassin, hence, no rules are triggered...

SPF + DKIM pass and DMARC fails

The domain s****g.nl has the following DMARC record:
"v=DMARC1; p=reject; rua=mailto:postmaster#s****g.nl,
mailto:dmarc#s****g.nl"
A valid SPF record for the sending mail server and none DKIM record.
The domain fo***de.com has a valid SPF and DKIM record.
Example 1
From: from#s****g.nl
To: thetoadres#mail.com
Result:
SPF: PASS
DKIM: FAIL
DMARC: PASS
Example 2
From: from#s****g.nl
Sender: response#fo***de.com
To: thetoadres#mail.com
Result:
SPF: PASS
DKIM: PASS
DMARC: FAIL
So when I send the email using a sender (on behalf of) the DMARC fails and the mail is not delivered.
Is there a explanation for this and maybe a solution to send emails on behalf of a domain which contains a DMARC reject policy and have a valid SPF for the sending mailserver?
Edit:
[Screenshot results...][1]
I have a feeling, it's failing on your ADKIM and ASPF Tests of DMARC. If SPF and DKIM passes, then it must be failing on both alignment tests.
Read this to understand more about Identifier Alignments
I seen several cases where there DKIM Validator is coded wrong and it will fail DMARC when it fails 1 alignment test, but both must fail according to the RFC Standards.
The only alignment tester I know about is this email tester, if you post the full headers of the sent emails. It'll be much easier to understand what might be wrong. You're only sharing part of the information and it's impossible to make a 100% accurate assessment. But I'm 80% confident the issue is with the alignment.
Based on the image you linked of your headers, I added an "a" to the beginning and "1" to the end so bots don't spam you.
Return-Path = response#afo***de1.com
DKIM Signature = d=afo***de1.com
From = info#as**g1.nl
So for ADKIM alignment to Pass the "from" domain must match the "d=" domain of the dkim signature
info#as**g1.nl <> afo***de1.com
For the ASPF Alignment to pass the "return-path" domain must match the "from" domain
afo***de1.com <> as**g1.nl
One of those need to match in order for DMARC to pass.

Sending EMails with Indy with multiple CCs. If one is incorrect nobody recieves the mail

I currently setting up a little tool for my company that is used to send info-mails to specific user groups.
But if one or more email addresses are incorrect (missing letter etc.) I get following error and the email isn't sent at all:
EIdSMTPReplyError
Requested action not taken: mailbox unavailable
invalid DNS MX or A/AAAA resource record
I set up the email like this:
adding the first email as main recipient
adding all others to the cclist
Is there a way to set up the email so atleast the other recipients are getting the email?
Some Infos:
Delphi 7
Indy 10
Thanks in advance <3
TIdSMTP has an OnFailedRecipient event:
type
TIdSMTPFailedRecipient = procedure(Sender: TObject; const AAddress, ACode, AText: String;
var VContinue: Boolean) of object;
AAddress is the email address, and ACode and AText contain the error details.
If VContinue is set to True (the default when OnFailedRecipient is assigned), the failed email is skipped and the next recipient is attempted.
The EIdSMTPReplyError exception is raised if either:
OnFailedRecipient is not assigned when a recipient fails.
VContinue is set to False.
all recipients fail, regardless of OnFailedRecipient.

Send email to address alternate from "To:"

I am implementing a sort of dynamic mailing-list system in Rails. I am looking to basically send an email and have the recipient receive it in this form:
From: person#whosentthis.com
To: mailing-list#mysite.com
<body>
Basically, the challenge is how do I send an email to an address while defining a different To: header so that they can easily reply to the mailing list or just the original sender?
Mail vs. Envelope
In emails as in physical mails (paper sheet in paper envelope), the recipient on the envelope may differ from the recipient on the letter sheet itself.
As the mailman would only consider the envelope's recipient, so do mail servers.
That means, one actually can tell the smtp service to send and email to a recipient different than the one listed in the To: field of the emails header.
Trying This Out Manually
You can try this out, manually, for example, by using the sendmail command of postfix.
# bash
sendmail really_send_to_this_address#example.com < mail.txt
where
# mail.txt
From: foo#example.com
To: this_will_be_seen_in_the_to_field_in_email_clients#example.com
Subject: Testmail
This is a test mail.
This will deliver the email to really_send_to_this_address#example.com, not to this_will_be_seen_in_the_to_field_in_email_clients#example.com, but the latter will be shown in the recipient field of the mail client.
Specifying the Envelope_to Field in Rails
The ActionMailer::Base internally uses the mail gem. Currently, Apr 2013, there is a pull request, allowing to specify the envelope_to field on a message before delivery.
Until this is pulled, you can specify the fork in the Gemfile.
# Gemfile
# ...
gem 'mail', git: 'git://github.com/jeremy/mail.git'
You need to run bundle update mail after that, and, depending on your current rails version, maybe also bundle update rails in order to resolve some dependency issues.
After that, you can set the envelope recipient of a mail message like this:
# rails
message # => <Mail::Message ...>
message.to = [ "this_will_be_seen_in_the_to_field_in_email_clients#example.com" ]
message.smtp_envelope_to = [ "really_send_to_this_address#example.com" ]
message.from = ...
message.subject = ...
message.body = ...
message.deliver
Documentation
https://github.com/mikel/mail/pull/477
http://rubydoc.info/github/jeremy/mail/master/Mail/Message#smtp_envelope_to%3D-instance_method
https://github.com/mikel/mail
Why not use the BCC header for this? Put person#whoshouldreceivethis.com into BCC and mailing-list#mysite.com into TO.
Clearification:
There is no technical solution for this. The email headers do what they do, you can't influence them in that once the email is on the way.
I am sure, though, you can find a combined use of TO, CC, BCC and REPLY-TO that gives you what you want.