{"id":859,"date":"2006-09-26T21:33:47","date_gmt":"2006-09-27T05:33:47","guid":{"rendered":"http:\/\/cephas.net\/blog\/2006\/09\/26\/bulk-import-of-email-addresses-into-movable-type-notifications\/"},"modified":"2006-09-26T21:33:47","modified_gmt":"2006-09-27T05:33:47","slug":"bulk-import-of-email-addresses-into-movable-type-notifications","status":"publish","type":"post","link":"https:\/\/cephas.net\/blog\/2006\/09\/26\/bulk-import-of-email-addresses-into-movable-type-notifications\/","title":{"rendered":"Bulk import of email addresses into Movable Type notifications"},"content":{"rendered":"<p>One of the blogs on my Movable Type installation is actually using the <a href=\"http:\/\/www.sixapart.com\/movabletype\/docs\/3.2\/09_email\/enabling_notifications.html\">notifications feature<\/a> built into <a href=\"http:\/\/www.sixapart.com\/movabletype\/\">Movable Type<\/a> (which gives you the ability to let people subscribe to a blog via email) and needed to do a bulk import of email addresses that he already had in <a href=\"http:\/\/en.wikipedia.org\/wiki\/Comma-separated_values\">csv format<\/a>. Unfortunately, <a href=\"http:\/\/www.sixapart.com\/\">Six Apart<\/a> doesn&#8217;t provide a way to do a bulk import so I dug into google. Because the install is backed by <a href=\"http:\/\/www.mysql.com\/\">MySQL<\/a>, the solution was to use the <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/load-data.html\">LOAD DATA INFILE<\/a> command, which reads a csv file from disk and loads the data into a table you specify.  In case someone else ever needs to do this with Movable Type, the syntax I ended up using looked like this:<\/p>\n<pre>\r\nLOAD DATA LOCAL INFILE 'contacts.csv' \r\nINTO TABLE mt_notification \r\nFIELDS TERMINATED BY ',' \r\nLINES TERMINATED BY '\\n' \r\n(notification_email,notification_blog_id,notification_name)\r\n<\/pre>\n<p>and my contacts.csv file looked like this:<\/p>\n<pre>\r\najohnson@cephas.net,10,Aaron Johnson\r\n...\r\n<\/pre>\n<p>Also interesting to note that <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/insert-speed.html\">according to the MySQL documentation<\/a>, the LOAD DATA INFILE command is usually 20 times faster (!) than using separate INSERT INTO statements. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the blogs on my Movable Type installation is actually using the notifications feature built into Movable Type (which gives you the ability to let people subscribe to a blog via email) and needed to do a bulk import of email addresses that he already had in csv format. Unfortunately, Six Apart doesn&#8217;t provide &hellip; <a href=\"https:\/\/cephas.net\/blog\/2006\/09\/26\/bulk-import-of-email-addresses-into-movable-type-notifications\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Bulk import of email addresses into Movable Type notifications<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/859"}],"collection":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/comments?post=859"}],"version-history":[{"count":0,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/859\/revisions"}],"wp:attachment":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/media?parent=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/categories?post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/tags?post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}