[SOLVED] Question regarding NativeMailer (mail() Error)

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
wurzel
Forum Newbie
Posts: 6
Joined: Thu May 31, 2007 6:18 am

[SOLVED] Question regarding NativeMailer (mail() Error)

Post by wurzel »

Hi!
I tried using the NativeMailer, but it always says my mail() function returned an error. After some tests I found out that its related to the additional parameter given to the mail function (my server doesn't use safe_mode) -> "-oi -f mail@domain.tld", in special the -oi parameter. If the code is modified to not include the "-oi" its working.

I'm not that much into sendmail&co and have no clue whatsoever what exactly this parameter does, so I just wanted to know if its safe to leave it out or if I have to configure something else so the error doesn't happen even with this on...

Thanks in advance for your interest
wurzel
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If you're looking for a better, more simple to work with solution, check out Swiftmailer.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

He's using SwiftMailer ;) I suspect an old verion though since that is a bug when safe_mode is turned on, the 5th parameter is not available. This was fixed a month or two ago (or at least, I was informed it now works as it should).

What version are you running?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

EDIT | I see you're not running safe mode. In that case the issue must lie somewhere with your PHP install. Have you got sendmail installed (is it sendmail or a symlink to something else?). Does anything show in your logs?

It is safe to remove those params, but you might not have much luck gettting your name/address to appear correctly without them.
wurzel
Forum Newbie
Posts: 6
Joined: Thu May 31, 2007 6:18 am

Post by wurzel »

I am using the (latest?) swiftmailer 3.2.4 for php4 hence my post in the swiftmailer forum *giggle*.

I don't think its a bug because my server has safe_mode disabled -> so it (supposedly) correctly passes the $param variable to the function. The question why -oi is troublesome or if it can be safely left out remains :wink:

Thanks for the fast replies... :)

Greetings
wurzel
wurzel
Forum Newbie
Posts: 6
Joined: Thu May 31, 2007 6:18 am

Post by wurzel »

:!: didn't see your edit before my previous post...

So far I had no problems with the to/replyto Address being in Swift_Address format, all test-emails arrived correctly.

My Server runs on Suse Linux 9.3 and uses qmail.

Could there be problems for other mail-recipients using mail() function in swiftmailer without "-oi" in the &param var or do my test-emails prove them to be sent correctly to all recipients?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

wurzel wrote:Could there be problems for other mail-recipients using mail() function in swiftmailer without "-oi" in the &param var or do my test-emails prove them to be sent correctly to all recipients?
Is it only the -oi, not the -f which is the problem? If the -f is in there then there's a good chance it will just works as it should. Nothing will stop the mail from sending, it would only change what's in the headers of the email.

Maybe I should make this settable as a sprintf() format string or something?

Code: Select all

$mail_conn->setParams("-oi -f %s");
Just thinking out loud.
wurzel
Forum Newbie
Posts: 6
Joined: Thu May 31, 2007 6:18 am

Post by wurzel »

Yes, only the -oi causes problems. Everything else doesn't.

And making this configurable would be nice, this way I wouldn't have to change the code in your script directly which would have to be done (at least for my current server/config) in future updates as well.

Anyways: thanks for this great script :D
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

wurzel wrote:Yes, only the -oi causes problems. Everything else doesn't.

And making this configurable would be nice, this way I wouldn't have to change the code in your script directly which would have to be done (at least for my current server/config) in future updates as well.

Anyways: thanks for this great script :D
No worries :) I'll update this in svn now since it's a trivial change.
wurzel
Forum Newbie
Posts: 6
Joined: Thu May 31, 2007 6:18 am

Post by wurzel »

Nice! I'm happy to hear that. Guess this closes my whole problem :)

Well, not sure if this is the right place to do so, but I wish you a very nice trip to australia in september. I know its not much, but maybe you can get a nice australian beer or something with the 5 bucks I donated :roll:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

wurzel wrote:Nice! I'm happy to hear that. Guess this closes my whole problem :)

Well, not sure if this is the right place to do so, but I wish you a very nice trip to australia in september. I know its not much, but maybe you can get a nice australian beer or something with the 5 bucks I donated :roll:
Got your donation thanks :) Very kind of you. Later this year I shall be sat on the whitest beach in the world (Hervey Bay), sipping from an ice cold beer (let's not forget the mouthwatering image of condensation rolling down the edge of bottle in the baking sun) and wondering if I'll ever decide to go back to work again!

Cheers bud!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

mail()'s 5th parameter now settable in v3.2.0:

http://www.swiftmailer.org/wikidocs/v3/ ... nativemail
wurzel
Forum Newbie
Posts: 6
Joined: Thu May 31, 2007 6:18 am

Post by wurzel »

Wow, very fast implementation :)

You got a little error in your description:
[...]By default this is “-oi -f %” where %s is[...]
I'm sure you meant
[...]By default this is “-oi -f %s” where %s is[...]

Not that it's not clear anyways, but just thought I'd point that out :roll:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

wurzel wrote:You got a little error in your description:
[...]By default this is “-oi -f %” where %s is[...]
Corrected :)

I'm off out for the rest of the weekend now. I'm a bit tipsy so forgive the typo :D Have a great weekend!
Post Reply