<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Focus the Web Tech Blog &#187; mailer</title>
	<atom:link href="http://tech.focustheweb.com/tag/mailer/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.focustheweb.com</link>
	<description>Programmazione, web, internet, howtos, etc.</description>
	<lastBuildDate>Sat, 24 Apr 2010 09:16:53 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails, configurazione base di ActionMailer</title>
		<link>http://tech.focustheweb.com/programmazione/ruby-programmazione/rails-configurazione-base-di-actionmailer/</link>
		<comments>http://tech.focustheweb.com/programmazione/ruby-programmazione/rails-configurazione-base-di-actionmailer/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 10:08:39 +0000</pubDate>
		<dc:creator>Giovanni Cappellotto</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[actionmailer]]></category>
		<category><![CDATA[configurazione]]></category>
		<category><![CDATA[mailer]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://tech.focustheweb.com/?p=333</guid>
		<description><![CDATA[







Mandare email con rails è semplice grazie al modulo ActionMailer.
Una configurazione base del modulo da inserire nel file config/environments/production.rb per mandare mail in ambiente di produzione è:

config.action_mailer.smtp_settings = &#123;
  :address =&#62; &#34;domain.of.smtp.host.net&#34;,
  :port =&#62; 25,
  :domain =&#62; &#34;domain.of.sender.net&#34;,
  :user_name =&#62; &#34;user&#34;,
  :password =&#62; &#34;password&#34;,
  :authentication =&#62; :login,
  :enable_starttls_auto [...]]]></description>
			<content:encoded><![CDATA[<p>
<!-- Begin Google Adsense code -->
<script type="text/javascript"><!--
google_ad_client = "pub-7194529311513014";
/* 468x60, creato 21/11/09 */
google_ad_slot = "8123373738";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End Google Adsense code -->
<br />
Mandare email con rails è semplice grazie al modulo <strong>ActionMailer</strong>.</p>
<p>Una <strong>configurazione base</strong> del modulo da inserire nel file <code>config/environments/production.rb</code> per mandare mail in ambiente di produzione è:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">action_mailer</span>.<span style="color:#9900CC;">smtp_settings</span> = <span style="color:#006600; font-weight:bold;">&#123;</span>
  <span style="color:#ff3333; font-weight:bold;">:address</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;domain.of.smtp.host.net&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:port</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">25</span>,
  <span style="color:#ff3333; font-weight:bold;">:domain</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;domain.of.sender.net&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:user_name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;user&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:password</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;password&quot;</span>,
  <span style="color:#ff3333; font-weight:bold;">:authentication</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:login</span>,
  <span style="color:#ff3333; font-weight:bold;">:enable_starttls_auto</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>dove:</p>
<dl>
<dt><code>:address =&gt;</code>, <code>:port =&gt;</code>
<dt/>
<dd>determinano l&#8217;indirizzo e la porta del server SMTP utilizzato per inviare le emails (di default impostati a <code>localhost</code> e 25)</dd>
<dt><code>:domain =&gt;</code>
<dt/>
<dd>il dominio utilizzato dal mailer per identificarsi al server SMTP. Normalmente viene usato il <em>top-level domain name</em> della macchina che manda le email, ma dipende anche dalla configurazione del server SMTP</dd>
<dt><code>:authentication =&gt;</code>
<dt/>
<dd>il valore può essere: <code>:plain</code>, <code>:login</code> o <code>:cram_md5</code>. Per scegliere il giusto valore da assegnare alla configurazione bisogna conoscere le impostazioni del server SMTP. Il parametro può essere omesso per server SMTP che non necessitano autenticazione (nel qual caso saranno inutili anche i parametri <code>:user_name</code> e <code>:password</code>)</dd>
<dt><code>:user_name =&gt;</code>, <code>:password =&gt;</code>
<dt/>
<dd>nome utente e password di autenticazione al server SMTP</dd>
<dt><code>:enable_starttls_auto =&gt;</code>
<dt/>
<dd>dalla versione 2.3 di rails ActionMailer cerca di stabilire in modo automatico una connessione al server attraverso il protocollo <em>tls</em> (Transport Layer Security), questo parametro ci permette di modificare il comportamento di default di ActionMailer (<a href="https://rails.lighthouseapp.com/projects/8994/tickets/1731-make-enable_starttls_auto-opt-in-in-actionmailer">https://rails.lighthouseapp.com/projects/8994/tickets/1731-make-enable_starttls_auto-opt-in-in-actionmailer</a>)</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://tech.focustheweb.com/programmazione/ruby-programmazione/rails-configurazione-base-di-actionmailer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
