Page 1 of 1

nuSendEmail: $from, $fromname ignored?

Posted: Wed Oct 23, 2019 9:12 am
by kev1n
Hi Steven,

Even when I pass a $from and $fromame in nuSendEmail($to, $from, $fromname ...), these arguments are not used when sending an email. Instead, the ones from the Email Settings are used.
Email Settings.png
E.g. : I send an email providing these arguments:

Code: Select all

$to = "something@test.com";
$from = "nubuilder@test.com";
$fromname = "nuBuilder";
nuSendEmail($to, $from, $fromname ...),
The provided arguments are ignored but the "From address" test@test.com and "From Name" Tester from the Email Settings are used.
This was not the case with older nuBuilder versions.

Re: nuSendEmail: $from, $fromname ignored?

Posted: Tue Nov 12, 2019 8:14 am
by kev1n
Steven,

Do you know how this is supposed to work?
The provided arguments are ignored but the "From address" test@test.com and "From Name" Tester from the Email Settings are used.
This was not the case with older nuBuilder versions.
Related question:
https://forums.nubuilder.cloud/viewtopic.php?f=19&t=10105

Re: nuSendEmail: $from, $fromname ignored?

Posted: Fri Nov 15, 2019 10:59 pm
by admin
We are rewriting the nuEmail() function.

It will be done in about a week.


Steven

Re: nuSendEmail: $from, $fromname ignored?

Posted: Mon Dec 30, 2019 12:35 pm
by kev1n
admin wrote: It will be done in about a week.
Since I haven't seen any updates for this, I uploaded my own patched file.

https://github.com/smalos/nuBuilder-Bug ... mailer.php

Modified rows:

Code: Select all

$nuEmailSettings->from_address  = $from_address != '' ? $from_address : _nuMarshallEmailSettingsHelper($setup, 'set_smtp_from_address');	
$nuEmailSettings->from_name	= $from_name != '' ? $from_name :  _nuMarshallEmailSettingsHelper($setup, 'set_smtp_from_name');	

Re: nuSendEmail: $from, $fromname ignored?

Posted: Fri Jan 10, 2020 11:10 pm
by admin
kev1n,

I have added your improvements now in the latest version on Sourceforge.

Thanks

If you could test what I've done and write an explanation of how to use your nuEmail(), I'll add it to the wiki.


Steven

Re: nuSendEmail: $from, $fromname ignored?

Posted: Mon Jan 13, 2020 1:59 pm
by kev1n
Tested & works for me.

Documentation:

$object = nuSendEmail($to, $from, $fromname, $content, $subject, $filelist, $html = false, $cc = "", $bcc = "", $reply_to_addresses = array())

Parameters

$to : The email address you want the message to go to.

$from : The email address you want to appear in the email header. If this parameter is left empty, the email address from Setup -> Email Settings is used.

$fromname : The name you want to appear in the email header. If this parameter is left empty, the email address from Setup -> Email Settings is used.

$content : The content of the message, if the parameter $html is set true, then you can include html content

$subject : The email subject you want to appear in the email header

$filelist : If you do not want to send attachments, you must still supply an empty array here, if you do want to send attachments, this array needs in the following format $filename=>$filesource

$html : true or false

$cc : Carbon copy: When you CC people on an email, the CC list is visible to all other recipients.

$bcc: Blind Carbon Copy: Other recipients will not see the Bcc recipient's email address in the mail.

$reply_to_addresses: It is the email address that the reply message is sent when you want the reply to go to an email address that is different than the From: address.


Return Value

$object: If an error has occurred the function returns false, as well as the error message. Else the function will return true and a confirmation message of "Message sent successfully" will be returned.


Description

Sends an email using the settings stored in Setup -> Email Settings


Example

$r = nuSendEmail('to_email@test.com','from_email@test.com','From nuBuilder','Content here','Subject here', [], true, 'cc_email@test.com', 'bcc_email@test.com')

nuDebug()

[0] : Array
(
[0] => 1
[1] => Message sent successfully
[2] =>
[3] =>
)

Re: nuSendEmail: $from, $fromname ignored?

Posted: Mon Jan 13, 2020 11:49 pm
by admin
kev1n,

Thanks for that man!

I appreciate all your help.

https://wiki.nubuilder.cloud/ ... uSendEmail


Steven