Apologies for delay in looking at this. I'm using code (running in WAMP on my laptop, not tried on a genuine website) :
$emailTo="rogerkeeling@f2s.com";
$emailSubject="Email Subject";
$fullMessage="email message";
$attachments="";
ini_set('SMTP','b.mx.nildram.net');
ini_set('smtp_port', '25');
ini_set('sendmail_from','rogerkeeling17@gmail.com'); # works ok: from and to email addresses handled correctly
#ini_set('sendmail_from','rogerkeeling@f2s.com'); #appears to work (no error reported) but no email arrives
$ok=mail($emailTo,$emailSubject,$fullMessage,$attachments);
echo ("rwk1".$ok."rwk2"

;
}
This works OK if sender is
rogerkeeling17@gmail.com and receiver rogerkeeling@f2s,com.
But works only if receiver is rogerkeeling@f2s,com. I would like to send from rogerkeeling@f2s,com to any email address.