Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuSendEmail: $from, $fromname ignored?

Questions related to using nuBuilder Forte.
Post Reply
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

nuSendEmail: $from, $fromname ignored?

Unread post 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.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: $from, $fromname ignored?

Unread post 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
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSendEmail: $from, $fromname ignored?

Unread post by admin »

We are rewriting the nuEmail() function.

It will be done in about a week.


Steven
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: $from, $fromname ignored?

Unread post 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');	
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSendEmail: $from, $fromname ignored?

Unread post 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
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: $from, $fromname ignored?

Unread post 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] =>
)
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSendEmail: $from, $fromname ignored?

Unread post by admin »

kev1n,

Thanks for that man!

I appreciate all your help.

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


Steven
Post Reply