Smtp email - from and bounce
Moderator: General Moderators
Smtp email - from and bounce
Hi
we send email with own smtp class
on this class use this
//Email From
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
to set FROM
We must setting a different email from email bounce, so the Return-Path bust be this new email
How to this ?
Thanks
we send email with own smtp class
on this class use this
//Email From
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
to set FROM
We must setting a different email from email bounce, so the Return-Path bust be this new email
How to this ?
Thanks
Re: Smtp email - from and bounce
Send a test email to yourself and look at the headers to find your problem. Some maiil servers are configured to deliver bounced messages to a specific address. Sometimes you can override it with -f like in this example:
Make sure you have the errors and warnings on to see if it fails to reconfigure.
Code: Select all
$from='me@email.com';
$returnpath="-f ".$from; // Forces the return path to be configured properly
$mail_sent = mail($to, $subject, $content, $headers, $returnpath);Re: Smtp email - from and bounce
Hello
we send directly to smtp .. not use mail() function
so need to set return-path as FROM
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
BUT not work if we send return-path with this method
we send directly to smtp .. not use mail() function
so need to set return-path as FROM
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
BUT not work if we send return-path with this method
Re: Smtp email - from and bounce
thankswebstyler wrote:Hi
we send email with own smtp class
on this class use this
//Email From
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
to set FROM
We must setting a different email from email bounce, so the Return-Path bust be this new email
How to this ?
Thanks
Re: Smtp email - from and bounce
??bhavani wrote:thankswebstyler wrote:Hi
we send email with own smtp class
on this class use this
//Email From
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
to set FROM
We must setting a different email from email bounce, so the Return-Path bust be this new email
How to this ?
Thanks
Re: Smtp email - from and bounce
What are you doing? You still need an smtp server. Who configured the server? Get them to fix it.webstyler wrote:we send directly to smtp .. not use mail() function
Re: Smtp email - from and bounce
we send email not with mail() function but with connection to smtp because need to manage a lot of smtp server, not only localEric! wrote:What are you doing? You still need an smtp server. Who configured the server? Get them to fix it.webstyler wrote:we send directly to smtp .. not use mail() function
so we have a class that use fsockopen and other comand to talk with smtp
all work fine
We need only to specify a return-path different from "FROM" value, and don't know how make this
Thanks
Re: Smtp email - from and bounce
Return-path is simply specified by the email's header, not a specific SMTP setting or something that requires a separate SMTP command.
Just make sure to include a line like
in the header of your email content (the stuff you send after the DATA command), and you're good.
By the way, you sure you want to implement this yourself? There are tons of open source solutions for this which really work fine. Personally I can recommend PHPMailer (have good experience with it myself).
Just make sure to include a line like
Code: Select all
Return-path: your@mommaBy the way, you sure you want to implement this yourself? There are tons of open source solutions for this which really work fine. Personally I can recommend PHPMailer (have good experience with it myself).
Re: Smtp email - from and bounce
Hello
We have try to add Return-path on the header send after DATA but this is replace with value "$from"

we send this header after DATA
From: $namefrom <$from>\nReply-To: reply@domain.comt\nReturn-path: <$bounce>\nSubject: $subject\nTo: $to\n$headers\n\n$message\n.\n"
but when email arrived return-path is = $from
:/
We work on this own library for our customer that need function and procedure, we cannot use external class or framework
We have try to add Return-path on the header send after DATA but this is replace with value "$from"
we send this header after DATA
From: $namefrom <$from>\nReply-To: reply@domain.comt\nReturn-path: <$bounce>\nSubject: $subject\nTo: $to\n$headers\n\n$message\n.\n"
but when email arrived return-path is = $from
:/
We work on this own library for our customer that need function and procedure, we cannot use external class or framework
Re: Smtp email - from and bounce
Strange, perhaps the SMTP server you're using does not allow custom Return-path addresses?
Have you tried connecting to a different SMTP server (from ISP, hosting provider, etc)? If that works, contact whoever is maintaining your current SMTP server, and tell them to fix this
Have you tried connecting to a different SMTP server (from ISP, hosting provider, etc)? If that works, contact whoever is maintaining your current SMTP server, and tell them to fix this
Re: Smtp email - from and bounce
uhm.. -f with mail() function return correct value
so think must go also with smtp send way .. :/
must know how to send "-fbounce@domain.com" on smtp connection
so think must go also with smtp send way .. :/
must know how to send "-fbounce@domain.com" on smtp connection
Re: Smtp email - from and bounce
You already did it by formatting the header sent to your server. Assuming your code is correctly defining $bounce and your header is properly formatted and your statement about sending the header AFTER the 'data' is just a language error or your talking about smpt commands(header is first followed by message body), then I would say your smtp server is causing the problem and your mail() function is using a config file that sets the server up correctly.webstyler wrote:must know how to send "-fbounce@domain.com" on smtp connection
Traditionally you need CRLF at the end of each line. http://www.faqs.org/rfcs/rfc822.html
Depends on what mailserver you are using....
Re: Smtp email - from and bounce
we test with mail() function and setting Return-path as header and not work, as most other server
work only if force with -f on extra header on mail()
so, think is the same on smtp command.. not work setting as header .. must be force or setting with specify rules
as tell before setting as header is ignored and email header have as return-path the same value sent on FROM smtp
work only if force with -f on extra header on mail()
so, think is the same on smtp command.. not work setting as header .. must be force or setting with specify rules
as tell before setting as header is ignored and email header have as return-path the same value sent on FROM smtp
Re: Smtp email - from and bounce
As Eric suggests, try using CRLF (that's "\r\n") line endings instead of just \r in your $header string.
If that doesn't make a difference, can you send a test mail with mail() and the -f parameter, so you get the correct Return-path in the header, and then copy all relevant fields *exactly* from that header (including correct upper/lower-casing while you're at it). Does that bring any improvement?
If that doesn't make a difference, can you send a test mail with mail() and the -f parameter, so you get the correct Return-path in the header, and then copy all relevant fields *exactly* from that header (including correct upper/lower-casing while you're at it). Does that bring any improvement?
Re: Smtp email - from and bounce
test with \r\nApollo wrote:As Eric suggests, try using CRLF (that's "\r\n") line endings instead of just \r in your $header string.
nothing change, my return-path is ignored
That's already done.. but mail() is local and not from one server to other server.Apollo wrote: If that doesn't make a difference, can you send a test mail with mail() and the -f parameter, so you get the correct Return-path in the header, and then copy all relevant fields *exactly* from that header (including correct upper/lower-casing while you're at it). Does that bring any improvement?
Think the issue is on exim or cpanel, that remove my return-path and insert default value