0

I am using yii2 advance . I want the contact form to send email to admin. but Its not working what should do? I tried in following way=>

'adminEmail' => 'admin@example.com', //wrote admin email id here

also changes
'useFileTransport' => false, what is exact steps to make it active can any one solve this?

Goli
  • 436
  • 5
  • 19

1 Answers1

3

In your config.php you should also configure a proper transport eg for a transport based of gmail account you could use

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        .....
        'useFileTransport' => false,//set this property to false to send mails to real email addresses
        //comment the following array to send mail using php's mail function
        //
        //
        /* configurazione servizio email da usare in locale (localhost sviluppo) */
        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => 'smtp.gmail.com',
            'username' => 'your_gmail_username@gmail.com',
            'password' => 'your_gmail_password',
            'port' => '587',
            'encryption' => 'tls',
        ],
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • hey... thank you ... it is working now... I just gmail account setting==>Allow less secure apps: ON – Goli Oct 16 '17 at 05:31
  • In mail I get subject and body... how to get name and email id field? ... where its database? – Goli Oct 16 '17 at 09:32
  • doesnt found email id of user who fills contact us form – Goli Oct 16 '17 at 10:09
  • this is another question ... post a new one with the needed infos (code, sample, clear term of the question) – ScaisEdge Oct 16 '17 at 10:50
  • asked new question regarding this but .. someone down vote for it :-( ... problem is admin gets email from himself not from user ..sharing card from gmail==>from: shailesh to: pharmadarshu@gmail.com date: 16 October 2017 at 10:54 subject: enquiry mailed-by: gmail.com .............In from tag it is email id of admin not of shailesh user... I want email of user how to get it – Goli Oct 27 '17 at 11:25
  • https://stackoverflow.com/questions/47029938/is-there-db-table-which-have-detais-of-contact-us-form-in-yii2 – Goli Oct 31 '17 at 07:27
  • given the link of new question to get mail Id of user https://stackoverflow.com/questions/47029938/how-to-get-email-fields-data-from-contact-us-page-in-the-mail – Goli Oct 31 '17 at 11:17
  • have you visit that question and getting my que properly> – Goli Nov 01 '17 at 11:15