Quantcast

Email plugin: sending email using different 'from' id

classic Classic list List threaded Threaded
4 messages Options
Lok
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Email plugin: sending email using different 'from' id

Lok
This post has NOT been accepted by the mailing list yet.
Hi,
I have been using Email plugin for different cases and so far i used to send from configured email id. but now i want to sent from different id based on different scenarios.

Here is my configurations in Config.groovy
grails {
           mail {
             host = "smtp.gmail.com"
             port = 465
             username = "support@xxxxx.com"
             password = "xxxxxxx"
             props = ["mail.smtp.auth":"true",  
                      "mail.smtp.socketFactory.port":"465",
                      "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
                      "mail.smtp.socketFactory.fallback":"false"]
           }
}

code in controller

mailService.sendMail {
        to "xxxxxxx@gmail.com"
        from "sales@xxxxx.com"
        subject "Test from different email Id "
         html "Test from different email Id"
}
As per above code email should be send from "sales@xxxxx.com" but it is sending from "support@xxxxx.com".

As per document we can send from different email id

http://grails.org/plugin/mail

mailService.sendMail {
   to "fred@g2one.com","ginger@g2one.com"
   from "john@g2one.com"
   cc "marge@g2one.com", "ed@g2one.com"
   bcc "joe@g2one.com"
   subject "Hello John"
   body 'this is some text'
}

Any suggestions, questions to resolve this issue is really appreciated.

Thanks in advance
Lok
Cheers, Lok
Lok
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Email plugin: sending email using different 'from' id

Lok
I found answer to this in some other bogs
http://code.vith.me/2011/05/multiple-mailsenders-in-grails-mail.html
Cheers, Lok
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Email plugin: sending email using different 'from' id

Ian Roberts
On 20/06/2012 20:13, Lok@sigma wrote:
> I found answer to this in some other bogs
> http://code.vith.me/2011/05/multiple-mailsenders-in-grails-mail.html

You are actually doing everything right in your own code, your problem
is that GMail's authenticated SMTP service only allows "from" addresses
that are registered against the GMail account that you're using to
authenticate (i.e. the main address or another "send mail as" address
you have added to your account settings).  If you try and use a
different address, GMail will silently rewrite the From line to use the
primary account address instead.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Lok
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Email plugin: sending email using different 'from' id

Lok
It is not working even if i use all gmail accounts. but it works with changes in plugin as per  link i shared before.
Cheers, Lok
Loading...