当前位置: 首页>>代码示例>>PHP>>正文


PHP Mailer::setFromAddress方法代码示例

本文整理汇总了PHP中Mailer::setFromAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::setFromAddress方法的具体用法?PHP Mailer::setFromAddress怎么用?PHP Mailer::setFromAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailer的用法示例。


在下文中一共展示了Mailer::setFromAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * Define the services on the applications (should be registered)
  * @method register
  * @param  Application $app
  * @return void
  */
 public function register(Application $app)
 {
     if (!isset($app['security.jwt.encoder'])) {
         throw new RuntimeException('Missing dependencies: SecurityJWTServiceProvider');
     }
     if (!isset($app['db'])) {
         throw new RuntimeException('Missing dependencies: DoctrineServiceProvider');
     }
     if (!isset($app['security.voters'])) {
         throw new RuntimeException('Missing dependencies: SecurityServiceProvider');
     }
     // clean simple-user-jwt options
     $app['user.jwt.options'] = isset($app['user.jwt.options']) ? $app['user.jwt.options'] : [];
     $app['user.jwt.options'] = array_replace_recursive(['class' => 'SimpleUser\\JWT\\User', 'controller' => 'SimpleUser\\JWT\\UserController', 'language' => 'SimpleUser\\JWT\\Languages\\English', 'registrations' => ['enabled' => true, 'confirm' => false], 'invite' => ['enabled' => false], 'forget' => ['enabled' => false], 'tables' => ['users' => 'users', 'customfields' => 'user_custom_fields'], 'mailer' => ['enabled' => false, 'from' => ['email' => 'do-not-reply@' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : gethostname()), 'name' => null], 'templates' => ['register' => ['confirm' => 'confirm.twig', 'welcome' => 'welcome.twig'], 'invite' => 'invite.twig', 'forget' => 'forget.twig'], 'routes' => ['login' => 'user.jwt.login', 'reset' => 'user.jwt.reset']]], $app['user.jwt.options']);
     // mailer check
     if ($app['user.jwt.options']['mailer']['enabled']) {
         if (!isset($app['mailer'])) {
             throw new RuntimeException('Missing dependencies: SwiftMailerServiceProvider');
         }
         if (!isset($app['url_generator'])) {
             throw new RuntimeException('Missing dependencies: UrlGeneratorServiceProvider');
         }
         if (!isset($app['twig'])) {
             throw new RuntimeException('Missing dependencies: TwigServiceProvider');
         }
     } else {
         if ($app['user.jwt.options']['invite']['enabled']) {
             throw new LogicException('If you want to enable invite, you need to configure the mailer');
         }
         if ($app['user.jwt.options']['forget']['enabled']) {
             throw new LogicException('If you want to enable forget, you need to configure the mailer');
         }
     }
     // mailer
     $app['user.jwt.mailer'] = $app->share(function ($app) {
         $mailer = new Mailer(new \Swift_Mailer($app['swiftmailer.transport']), $app['url_generator'], $app['twig']);
         $mailer->setFromAddress($app['user.jwt.options']['mailer']['from']['email']);
         $mailer->setFromName($app['user.jwt.options']['mailer']['from']['name']);
         return $mailer;
     });
     // generate simple-user options
     $app['user.options'] = ['mailer' => ['enabled' => false], 'userClass' => $app['user.jwt.options']['class'], 'userTableName' => $app['user.jwt.options']['tables']['users'], 'userCustomFieldsTableName' => $app['user.jwt.options']['tables']['customfields']];
     // register simple-user
     $app->register(new UserServiceProvider());
     // cnam/security-jwt-service-provider need the users list in $app['users']
     $app['users'] = $app->share(function () use($app) {
         return $app['user.manager'];
     });
 }
开发者ID:thcolin,项目名称:silex-simpleuser-jwt,代码行数:55,代码来源:UserProvider.php

示例2: sendmail

 function sendmail($to, $subject, $message, $from)
 {
     $mailer = new Mailer();
     $mailer->setFromAddress($from);
     return $mailer->send($to, $subject, $message);
 }
开发者ID:pkdevboxy,项目名称:osTicket-1.7,代码行数:6,代码来源:class.mailer.php

示例3: sendmail

 function sendmail($to, $subject, $message, $from)
 {
     $mailer = new Mailer(null, array('notice' => true, 'nobounce' => true));
     $mailer->setFromAddress($from);
     return $mailer->send($to, $subject, $message);
 }
开发者ID:Jride,项目名称:OSTicket-Thaiconnections,代码行数:6,代码来源:class.mailer.php


注:本文中的Mailer::setFromAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。