Return-Path in mail()

software development

#1

Okay, so I search the forums and tried various headers but I’m having troubles changing the Return-Path which is breaking a major component in my script.

I have a LOT of header information to set, so using -f doesn’t cut it. I need to set From:, Mime Version, Content-Type, Content-Transfer-Encoding, etc.

Here is what I’ve tried so far

[code] $header = sprintf(‘From: %s%s’, $this->from, \Objects\Email::NEWLINE);
$header = sprintf(‘Reply-To: %s%s’, $this->from, \Objects\Email::NEWLINE);
$header = sprintf(‘Errors-To: %s%s’, $this->from, \Objects\Email::NEWLINE);
$header = sprintf(‘Return-Path: %s%s’, $this->from, \Objects\Email::NEWLINE);
if (!empty($this->attachment))
{
$filename = basename($this->attachment);
$uid = md5(uniqid());

				$header .= sprintf('MIME-Version: 1.0%s', \Objects\Email::NEWLINE);
				$header .= sprintf('Content-Type: Multipart/Mixed; boundary="%s"%s%s', $uid, \Objects\Email::NEWLINE, \Objects\Email::NEWLINE);
				$header .= sprintf('This is a multi-part message in MIME format.%s', \Objects\Email::NEWLINE);
				$header .= sprintf('--%s%s', $uid, \Objects\Email::NEWLINE);
				$header .= sprintf('Content-Type: text/plain; charset="iso-8859-15"%s', \Objects\Email::NEWLINE);
				$header .= sprintf('Content-Transfer-Encoding: 7bit%s%s', \Objects\Email::NEWLINE, \Objects\Email::NEWLINE);
				$header .= sprintf('%s%s%s', $this->message, \Objects\Email::NEWLINE, \Objects\Email::NEWLINE);
				$header .= sprintf('--%s%s', $uid, \Objects\Email::NEWLINE);
				$header .= sprintf('Content-Type: %s; name="%s"%s', $this->attachmentMimeType, $filename, \Objects\Email::NEWLINE);
				$header .= sprintf('Content-Transfer-Encoding: base64%s', \Objects\Email::NEWLINE);
				$header .= sprintf('Content-Disposition: attachment; filename="%s"%s%s', $filename, \Objects\Email::NEWLINE, \Objects\Email::NEWLINE, \Objects\Email::NEWLINE);
				$header .= sprintf('%s%s', chunk_split(base64_encode(file_get_contents($this->attachment))), \Objects\Email::NEWLINE, \Objects\Email::NEWLINE);
				$header .= sprintf('--%s--%s', $uid, \Objects\Email::NEWLINE);[/code]

None of which is changing the Return-Path header. Please help, I am at a lost and have been at this for a few hours now.
[hr]
Neermind, wasn’t thinking clearly, as the -f is in addition to your headers.