Page 1 of 1

Sending bug report with fake sender email?

Posted: Wed Jun 01, 2016 3:43 pm
by Whookie
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.

Re: Sending bug report with fake sender email?

Posted: Wed Jun 01, 2016 4:16 pm
by madshi
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?

Posted: Wed Jun 01, 2016 9:39 pm
by Whookie
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).

Re: Sending bug report with fake sender email?

Posted: Wed Jun 01, 2016 9:42 pm
by madshi
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.

Re: Sending bug report with fake sender email?

Posted: Sat Aug 13, 2016 11:18 pm
by slemmnord
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.
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:

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));
  }
Now, the messages in my inbox will show the name the user entered but source e-mail will be the same. The real users e-mail will be in the attached bugreport.txt and can be copied easily if one has to contact the user.

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);
I hope that's helpful for someone.

Re: Sending bug report with fake sender email?

Posted: Mon Oct 10, 2016 11:20 am
by Whookie
Sorry for the long delay I had other urgent things to do :o , but for the sake of completeness this is my current solution (in the .dpr of my project):

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.
This results in the following email:
bugreport.png
bugreport.png (15.3 KiB) Viewed 7345 times