의 필드는,이 필드는 주소를 하나 이상 포함 할 수 있습니다 "로"A "에서"나처럼 보이는, 각 주소는 "[email protected]"
또는 "John D Jr <[email protected]>"
구문 분석 이메일 주소 "에"이메일에 루비
그래서 "에서"필드는 다음 중 하나처럼 보일 수 있습니다 등등
"[email protected]"
"[email protected], Bob Blue <[email protected]>"
"Abe Allen <[email protected]>, [email protected]"
"Abe Allen <[email protected]>, Bob Blue <[email protected]>"
"Abe Allen <[email protected]>, Bob Blue <[email protected]>, [email protected]"
하고 있습니다.
이 필드를 구문 분석하고 각 주소의 이메일이 유효한지 추출한 다음 이름이있는 경우 해당 이름을 추출합니다. 전자 메일 표준에 익숙하지 않기 때문에 필자는 주소 필드의 모양을 알 수없는 경우가 있습니다. 이 일을 할 수있는 루비 라이브러리가 있습니까?
전자 메일 주소의 구문 분석 및 유효성 검사는 간단한 작업이 아닙니다. 형식의 범위가 크고 주소가 유효하더라도 가짜이며 배달 가능한 주소가 아닐 수도 있습니다. "[RFC를 읽을 때까지 전자 메일 주소의 유효성을 검증하는 방법을 알고있었습니다] (http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address- until-i.aspx) "에 대한 흥미로운 기사가 있습니다. 또한 [Wikipedia의 기사] (http://en.wikipedia.org/wiki/Email_address)와 [SMTP RFC] (http://tools.ietf.org/html/rfc5322) 자체. –