Sending bug report with fake sender email?
Sending bug report with fake sender email?
Hi,
I'm using madExcept to send bug reports as a smpt-client (through a dedicated mail-account from our provider). This works fine but from time to time I get feedback that sending with a fake account does not always work.
For example I tried somereallymadcustomer@mad.com and that works while somereallymadcustomer@mad.as.hell doesn't.
While one could argue that using a valid email is good practice (and should be enforced) an unsent bug report is a loss (peronally I'd rather have it from what ever source than having none).
The question is: Is this is a restriction from madExcept or the result from communication with the smtp-server?
In addition, the message reported back ('Sorry, sending the bug report didn't work') is not very helpful. I could change the text of that message but that might not be correct for other failure-reason.
So maybe there is a way to ignore the sender email address (provide none or internally replace it if the one used is wrong) or get some feedback and customize that message only if sending failed because of an invalid email addy.
I'm using madExcept to send bug reports as a smpt-client (through a dedicated mail-account from our provider). This works fine but from time to time I get feedback that sending with a fake account does not always work.
For example I tried somereallymadcustomer@mad.com and that works while somereallymadcustomer@mad.as.hell doesn't.
While one could argue that using a valid email is good practice (and should be enforced) an unsent bug report is a loss (peronally I'd rather have it from what ever source than having none).
The question is: Is this is a restriction from madExcept or the result from communication with the smtp-server?
In addition, the message reported back ('Sorry, sending the bug report didn't work') is not very helpful. I could change the text of that message but that might not be correct for other failure-reason.
So maybe there is a way to ignore the sender email address (provide none or internally replace it if the one used is wrong) or get some feedback and customize that message only if sending failed because of an invalid email addy.
Re: Sending bug report with fake sender email?
Since it sometimes works and sometimes not, it's unlikely to be madExcept's "fault". I don't think I'm doing any checks for valid domains. It's very likely the SMTP server which is doing a quick check on the sender email domain, to reduce spam. Why don't you simply use the receiver email (= your own) as the sender email?
Re: Sending bug report with fake sender email?
I allready suspected that but wasn't aware that I could use my own address!
How's that done?
Can I preset or even remove the user input for their address (I would love to have a username for those that would like to provide that information but could easly do without their email address).
How's that done?
Can I preset or even remove the user input for their address (I would love to have a username for those that would like to provide that information but could easly do without their email address).
Re: Sending bug report with fake sender email?
You can set "exceptIntf.MailFrom" in a little exception handler.
Of course you can remove the email address edit field from the contact form, if you prefer it that way. You can then not "reply" to the user's report, though. Which right now you probably can, if the user enters a valid email address.
Of course you can remove the email address edit field from the contact form, if you prefer it that way. You can then not "reply" to the user's report, though. Which right now you probably can, if the user enters a valid email address.
Re: Sending bug report with fake sender email?
I ran into similar problem because of SPF. In essence, the PHP script is spoofing the sender address. And SPF is pretty much specifically designed to prevent that. So i disabled the following line in bugrep.php:madshi wrote: Of course you can remove the email address edit field from the contact form, if you prefer it that way. You can then not "reply" to the user's report, though. Which right now you probably can, if the user enters a valid email address.
Code: Select all
if (isset($_POST['MailFrom']))
{
$mailFrom = $_POST['MailFrom'];
$i1 = strpos($mailFrom, '<');
$i2 = strrpos($mailFrom, '>');
if (!(($i1 === false) || ($i2 === false) || ($i1 >= $i2)))
{
// $mailer->From = trim(substr($mailFrom, $i1 + 1, $i2 - $i1 - 1)); -- disabled due to SPF
$mailer->FromName = trim(substr($mailFrom, 0, $i1));
}
Hmm... as i type this i've just had an even better idea -- instead of spoofing mailfrom which will lead to trouble with SPF, add the users e-mail to "reply-to" field in message header. That should solve both problems
Something like this (untested):
Code: Select all
// $mailer->From = trim(substr($mailFrom, $i1 + 1, $i2 - $i1 - 1)); -- disabled due to SPF
$mailer->FromName = trim(substr($mailFrom, 0, $i1));
$mailer->addReplyTo(trim(substr($mailFrom, $i1 + 1, $i2 - $i1 - 1)), $mailer->FromName);
Re: Sending bug report with fake sender email?
Sorry for the long delay I had other urgent things to do , but for the sake of completeness this is my current solution (in the .dpr of my project):
This results in the following email:
Code: Select all
{$IfDef madExcept}
procedure ExceptActionProc(action: TExceptAction; const exceptIntf: IMEException; var handled: boolean);
begin
if action = eaSendBugReport2 then
begin
exceptIntf.MailBody := 'Reply address: '+exceptIntf.MailFrom+#13#10#13#10+exceptIntf.MailBody;
exceptIntf.MailFrom := 'Customer device<machine@my.domain>';
end;
end;
{$EndIf}
begin
...
{$IfDef madExcept}
RegisterExceptActionHandler(ExceptActionProc, stDontSync);
{$EndIf}
...
end.