• Resolved noam8080

    (@noam8080)


    With the new version (1.6.22), In the Manual Configuration page, “message” tab, I filled in a different Envelope From Address and Message From Address. I also put a piece of code that should set the sender email and name:
    add_filter( ‘wp_mail_from’, function( $email ) {
    return ‘[email protected]’;
    });
    add_filter( ‘wp_mail_from_name’, function( $name ) {
    return ‘??? ??’;
    });
    But still the emails come without a name, and from the actual gmail address which actually sends the email ([email protected])

    I think there’s a problem with the new version, or am I missing something?
    thabjs

    https://www.ads-software.com/plugins/postman-smtp/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Jason Hendriks

    (@jasonhendriks)

    But still the emails come … from the actual gmail address which actually sends the email ([email protected])

    Gmail only supports a different Message From email address if you enable their Send Mail As feature. See https://support.google.com/mail/answer/22370?hl=en

    But still the emails come without a name

    add_filter( 'wp_mail_from_name', function( $name ) {
    return '??? ??';
    });

    Anonymous functions are only support in PHP 5.3 and up. Try:

    add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );
    function custom_wp_mail_from_name( $original_email_from ) {
    	return '??? ??';
    }

    To be honest I’m not sure if either Gmail SMTP, or Zend_Mail which powers Postman, support international characters in email names (RFC 6530).

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    I just tested it myself. I tested first with the Mandrill server and then with the Gmail server. Looks like both Postman, Mandrill SMTP and Gmail SMTP support RFC 6530.

    Postman’s transcript:

    X-Mailer: Postman SMTP 1.6.23c for WordPress (https://www.ads-software.com/plugins/postman-smtp/)
    From: =?UTF-8?Q?=D7=A4=D7=99=D7=A7=20=D7=90=D7=A4?= <[email protected]>

    And the email at https://www.gmail.com:

    ??? ??? via mail128-132.atl41.mandrillapp.com
    1:56 PM (2 minutes ago)
    to me
    ??? ??? <[email protected]>
    2:02 PM (2 minutes ago)
    to bcc: jason
    Thread Starter noam8080

    (@noam8080)

    thanks jason

    so there’s no problem with the hebrew in the name, though i changed it to english to be sure..

    my php supports the anonymous functions. if it didn’t it would give a syntax error i’m sure.

    what i want is that when a user get’s an email from my website, it will not display the email address in gmail, but another email address, or at least a name which i can choose.

    i understand sending a different “from” address from gmail is impossible. the link you sent asks me to do something in my gmail settings, and to add another sender gmail asks me the smtp of that other email. i don’t have an smtp account or i wouldn’t use gmail in the first place

    so how do i change the from name header?

    in the “message” tab in the postman configuration settings, there’s an “Envelope From Address” field, “Message From Address” email and name fields.
    you mean to say all of them have no effect at all when sending emails through gmail?
    can i do anything to set the name of the sender when sending through gmail api?

    thanks

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    There is no difference between SMTP and API when it comes to this policy.

    At the link I sent, follow the instructions for “I’m a Google Apps for Work user sending from a domain alias or email alias.”

    Does that work?

    Thread Starter noam8080

    (@noam8080)

    i dont understand
    i choose “I’m a Google Apps for Work user sending from a domain alias or email alias.”
    it sends me to a place where i can type an alternative email address to send from.
    i put in a name, and an email address ([email protected])
    and click next.
    it then asks me for smtp server, username and password for the alternative email address i just typed in before.
    i don’t have a real alternative SMTP email address, or i wouldn’t have to use gmail in the first place.
    there’s no way around it, is there?
    thanks

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    You are right, I tried it myself with a non-Google address and it asked me for SMTP credentials. It only doesn’t do that when the email address you enter is a Google Apps email address.

    If you can wait for the next version of Postman, it will include the Mandrill API, which works over HTTPS just like the Gmail API. Then you can switch your SMTP server from Google to Mandrill and Mandrill will support your alternative Message From name and address (with your Gmail address – the only thing that will change is the outgoing server). I’ve just moved so, I will probably add this around August, once I get the house set up.

    Hi Jason,

    I have a follow up question with regards to this solution. I’ve successfully added a ([email protected]) to my send mail as settings for my primary account ([email protected]).

    The form on our website uses this address to send mail, which sends to ([email protected]) which I get in my main inbox.

    The issue i’m having, is since i’m technically the one sending, it doesn’t go to my inbox and shows as unread. I’m tried the setting “treat as alias” on and off but it doesn’t seem to have an effect.

    Is there anyway to route emails so i’ll still be notified of them as unread. even if sent from my account technically? Here is an example screenshot, that shows the email I got, which i was able to find outside of my inbox marked as read.

    Also, this is a google apps domain.

    Thanks so much for this plugin, it really is the best comprehensive solution and i’ve been searching for months.
    Nathan

    There is the link ^^
    Accidentally messed up the formatting. Sorry for double post.

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Is [email protected] a group mailbox? i’ve notice that Google does not copy an email to a recipient in a group if that recipient is also the sender.

    What you probably want is no-reply@ to be the Envelope From, no-reply@ to be the Message From, quotes@ to be the recipient and nathanguenther@ to be a member of quotes@.

    Or make up a new account for the website, such as website@. Then you have website@ as the Envelope From, no-reply@ as the Message From, quotes@ as the recipient and nathanguenther@ as a member of quotes.

    Yes, its a group that myself and a couple others get.

    Maybe I misunderstand, but isn’t that what I already have? Except within POSTMAN SMTP, the envelope from must be the same as the client ID which is (nathanguenther@).

    This is a google apps domain and the gmail API I am using, so when i change the envelop to no-reply it doesn’t work, only the message-from works with no-reply.

    Regarding your second solution, If i were to do that wouldn’t that be the same issue? The envelop would still have to be my google account (nathanguenther@)

    Thanks for the speedy response

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    Maybe I misunderstand, but isn’t that what I already have?

    No. You have natahnguenther@ as the Envelope From. Change it to no-reply@ and create a Client ID with the no-reply@ account.

    when i change the envelop to no-reply it doesn’t work, only the message-from works with no-reply.

    It will work if no-reply@ is a true user account (i.e. you can login to Google Apps with it) and you create a Client ID when logged in to Google as no-reply@.

    Regarding your second solution, If i were to do that wouldn’t that be the same issue? The envelop would still have to be my google account

    In the second solution the envelope becomes website@. For some people it makes more sense for the sent mail to end up at an account named website@ rather than no-reply@

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    The point is Nathan can’t be the sender, if the recipient is a group that Nathan belongs to.

    Heck, even create a free @gmail.com address to be the true sender if you choose. Just as long as it’s not Nathan!

    Sorry for the delay… it’s been a week!

    Ah yes I see your point. [email protected] is not a user, that was the whole idea. It’s a service account / distribution group whatever you wanna call it.

    I could use any random email off-domain sure, but for DKIM / SPF / DMARC purposes, and consistency & professionalism reasons, we want it to come from an email within our domain that’s not a user.

    If this is not possible I understand, the frustrating thing is I had it working before, without any plug-ins if i remember correctly.

    Once again thanks for this plugin and the great support!

    Plugin Author Jason Hendriks

    (@jasonhendriks)

    It is possible. Just do what I wrote above.

    Or make up a new account for the website, such as website@. Then you have website@ as the Envelope From, no-reply@ as the Message From, quotes@ as the recipient and nathanguenther@ as a member of quotes.

    Where website is a real user, no-reply is a group or alias, quotes is a group, and nathanguenther is a real user. This solution is very common.

    Cheers

    Yes I understand that is an option, however it is not ideal as i was trying to explain.

    In that case I would have to pay for another user monthly within Google Apps, which is why i wanted to use a group / distribution account instead.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Can't change sender email and name in the new version (Gmail API)’ is closed to new replies.